ecco lo script...devo creare un nuovo ciclo???
<?php
//
$receiverMail = 'eleinad85@gmail.com';
//
$subject = 'CHECK LIST';
//
$nome = trim(stripslashes($_POST['nome']));
$cognome = trim(stripslashes($_POST['cognome']));
$struttura = trim(stripslashes($_POST['struttura']));
$auditor = trim(stripslashes($_POST['auditor']));
$verifica = trim(stripslashes($_POST['verifica']));
$checklist = trim(stripslashes($_POST['checklist']));
$d1_3= trim(stripslashes($_POST['d1_3']));
$d1_2= trim(stripslashes($_POST['d1_2']));
$d1_1= trim(stripslashes($_POST['d1_1']));
$d1_0= trim(stripslashes($_POST['d1_0']));
$d1_na= trim(stripslashes($_POST['d1_na']));
$d2_3= trim(stripslashes($_POST['d2_3']));
$d2_2= trim(stripslashes($_POST['d2_2']));
$d2_1= trim(stripslashes($_POST['d2_1']));
$d2_0= trim(stripslashes($_POST['d2_0']));
$d2_na= trim(stripslashes($_POST['d2_na']));
$d3_3= trim(stripslashes($_POST['d3_3']));
$d3_2= trim(stripslashes($_POST['d3_2']));
$d3_1= trim(stripslashes($_POST['d3_1']));
$d3_0= trim(stripslashes($_POST['d3_0']));
$d3_na= trim(stripslashes($_POST['d3_na']));
$d4_3= trim(stripslashes($_POST['d4_3']));
$d4_2= trim(stripslashes($_POST['d4_2']));
$d4_1= trim(stripslashes($_POST['d4_1']));
$d4_0= trim(stripslashes($_POST['d4_0']));
$d4_na= trim(stripslashes($_POST['d4_na']));
$d5_3= trim(stripslashes($_POST['d5_3']));
$d5_2= trim(stripslashes($_POST['d5_2']));
$d5_1= trim(stripslashes($_POST['d5_1']));
$d5_0= trim(stripslashes($_POST['d5_0']));
$d5_na=trim(stripslashes($_POST['d5_na']));
$email = $_POST['mail'];
//
$stringa1 = "ATTENZIONE Tutti i campi sono obbligatori!";
//
$stringa2 = "l'indirizzo mail non è valido";
//
$stringa3 = "la checklist è stata inviata.grazie!";
// formato del messaggio
$msgformat = "La persona $nome $cognome ha compilato la seguente cechklist:\n\nnome checklist: $checklist\nstruttura: $struttura \nauditor: $auditor \nverifica del:$verifica \nmail: $email\nrisposte $d1_3 $d1_2 $d1_1 $d1_0 $d1_na \n$d2_3 $d2_2 $d2_1 $d2_0 $d2_na \n$d3_3 $d3_2 $d3_1 $d3_0 $d3_na \n$d4_3 $d4_2 $d4_1 $d4_0
//
$i=1;
while($i<=110)
{
if($_POST["note".$i]!='')
$msgformat.="Note".$i.":".$_POST["note".$i]."";
$i++;
}
///upload
$HTTP_POST_FILES['file']
// definisce i campi obbligatori (da personalizzare con quelli del proprio form)
if (( $nome == "" ) || ( $cognome == "" ) || ( $email == "" ))
// popup di errore sui campi obbligatori
{
echo "<script language=\"JavaScript\">\n";
echo "alert(\"$stringa1\");\n";
echo "javascript:history.go(-1);";
echo "</script>";
}
// controllo del formato della email
else if (eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$", $email))
{
// invia la email a me
mail($receiverMail, $subject, $msgformat, "From: $email");
// nelle prossime righe definisco se voglio un semplice popup che avvisa l'utente che il messaggio è stato inviato (OPZIONE1) e che lo fa ritornare automaticamente alla pagina dove ha compilato il form
// OPPURE
// se ridirezionarlo verso una pagina web specifica (OPZIONE2)
// OPZIONE1:
// popup di messaggio inviato e ritorno alla pagina precedente
// decommentare $stringa3
// commentare tutto se si usa OPZIONE2 (per commentare usare /* all'inizio e */ alla fine delle righe da commentare)
echo "<script language=\"JavaScript\">\n";
echo "alert(\"$stringa3\");\n";
echo "javascript:history.go(-1);";
echo "</script>";
}
// OPZIONE2:
// popup di messaggio inviato e ridirezionamento ad una pagina web
// decommentare $redirect
// commentare tutto se si usa OPZIONE1 (per commentare usare /* all'inizio e */ alla fine delle righe da commentare)
/* echo "<script language=\"JavaScript\">\n";
echo "window.location.href=(\"$redirect\");\n";
echo "</script>";
}
*/
// popup di errore se fallisce il controllo formato email
else
{
echo "<script language=\"JavaScript\">\n";
echo "alert(\"$stringa2\");\n";
echo "javascript:history.go(-1);";
echo "</script>";
}
?>

Rispondi quotando