Hi there,
I'm new to php and I have a parse error with a really simple script which I can't understand why it's not working
Basically I have a contact form in which your select a departement, the department value is posted to the send.php file to send the mail and depending on the selected department, the destination email changes.
Here is the send.php script :
$departement = $_POST['departement']; $nom = $_POST["name"]; $courriel = $_POST["email"]; $telephone = $_POST["phone"]; $message = $_POST["message"]; //change this to your email. if($departement=='Informations'){ $to1 = "rocky@email1.com"; $to2 = "pierre@email1.com"; $to3 = "john@email1.com"; } <--PARSE ERROR? elseif ($departement=='Ventes'){ $to1 = "sam@email1.com"; $to2 = "john@email1.com"; } elseif ($departement=='Recrutement'){ $to1 = "isaax@email1.com"; $to2 = "john@email1.com"; } $from = $courriel; $subject = "Nouveau message recu de votre site web"; //begin of HTML message $message = <<<EOF <html> <body bgcolor="#FFFFFF"> <h1>Courriel Recu du site web</h1> <br /><br /> Vous avez recu un nouveau courriel d'un client a partir de votre site web.<br /> Veuillez contacter le client dans les plus brefs delais.<br /><br /> Nom du client : $nom <br /><br /> Telephone : $telephone <br /> Courriel : $courriel <br /><br /> Departement : $departement<br /> Message du client : $message </body> </html> EOF; //end of message $headers = "From: $from\r\n"; $headers .= "Content-type: text/html\r\n"; // now lets send the email. if($departement=='Informations'){ mail($to1, $subject, $message, $headers); mail($to2, $subject, $message, $headers); mail($to3, $subject, $message, $headers); } elseif ($departement=='Ventes'){ mail($to1, $subject, $message, $headers); mail($to2, $subject, $message, $headers); } elseif ($departement=='Recrutement'){ mail($to1, $subject, $message, $headers); mail($to2, $subject, $message, $headers); } ?>
Here's the error I'm getting :PHP Parse error: syntax error, unexpected '}' in /home3/centreau/public_html/contact-auto-doum-centre-auto-dumoulin/send.php on line 21
If anyone can help me out it would be really appreciated!
Thanks!1