Ciao ragazzi...ho due pagine...una con un form e una con lo script php che invia i dati alla mia mail...tuttavia mi da un errore...HELP!
Prima pagina (quella con il form):
Seconda pagina (quella che elabora la script php):Codice:<html> <head> <meta http-equiv="Content-Language" content="it"> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>CONTATTI</title> </head> <body> <form method="POST" action="http://xxxxxxxxxx/sendate.php"> <p><font face="Calibri" style="font-size: 15pt">CONTATTI: </font></p> <table border="0" width="46%" id="table1" style="font-family: Calibri; font-size: 12pt; font-style: oblique" height="340"> <tr> <td width="149">Nome</td> <td><input type="text" name="name" size="38"></td> </tr> <tr> <td width="149">Cognome</td> <td><input type="text" name="lname" size="38"></td> </tr> <tr> <td width="149">Email</td> <td><input type="text" name="email" size="38"></td> </tr> <tr> <td width="149">Telefono</td> <td><input type="text" name="tel" size="38"></td> </tr> <tr> <td width="149">Motivo del contatto:</td> <td> <select name="motivo"> <option value="commerciale">Informazioni commerciali</option> <option value="preventivo">Richiesta preventivo</option> <option value="appuntamento">Prenotazione appuntamento</option> </select></td> </tr> <tr> <td width="149">Messaggio:</td> <td><textarea rows="11" name="mess" cols="29"></textarea></td> </tr> </table> <INPUT type="submit" value="Invia"> </form> </body> </html>
L'errore che mi da è:Codice:<?php $nome=$_POST['name']; $cognome=$_POST['lname']; $email=$_POST['email']; $telefono=$_POST['tel']; $motivo=$_POST['motivo']; $messaggio=$_POST['mess']; if($name!=null and $cognome!=null and $email!=null and $telefono!=null and $messaggio!=null){//se tutte le variabili sono state definite propongo il link $to = "XXXXXXXX@gmail.com"; // IL SOGGETTO DELLA MAIL $subject = "Modulo proveniente dal sito <a href=\"http://www.studio.it\" target=\"_blank\"><a href="http://www.studio.it" target="_blank">www.studio.it</a></a>"; // COSTRUZIONE DEL CORPO DEL MESSAGGIO $body = “Contenuto del modulo:nn”; $body .= “Dati personali ;<br>nome: ” . trim(stripslashes($_POST["name"])) . “n”; $body .= “cognome: ” . trim(stripslashes($_POST["lname"])) . “n”; $body .= “email: ” . trim(stripslashes($_POST["email"])) . “n”; $body .= “telefono: ” . trim(stripslashes($_POST["tel"])) . “n”; $body .= “motivo: ” . trim(stripslashes($_POST["motivo"])) . “n”; $body .= “messaggio: ” . trim(stripslashes($_POST["mess"])) . “n”; if(@mail($to, $subject, $body)) { // SE L’INOLTRO E’ ANDATO A BUON FINE… echo “La mail è stata inoltrata con successo!”; } else {// ALTRIMENTI… echo “Si sono verificati dei problemi nell’invio della mail.”; } }else{ echo “Invio dati fallito: prego riempire tutti i campi e riprocedere”; } ?>
Parse error: syntax error, unexpected T_STRING in /membri/santadown/sendate.php on line 17
In più mi piacerebbe inserire il controllo tramite immagine captcha o tramite la somma di due valori...
Dove posso sistemare il codice??
Dopo che lo script controlla che tutti i campi sono pieni (come ultimo controllo all'invio??)?
Cioè...invece che inviare l'email dopo l'else metto un'altra if???
Aiuttttt!