Jump to content

Unknown parse error


patheticsam

Recommended Posts

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

Link to comment
Share on other sites

Well I gave to complete script. Thats the reason why I can't understand why I'm getting this error??

Well, I get no parse errors when I test your code. Make sure that you end all of your statements correctly and make sure that you have your curly braces placed in correct places. Make sure that all of your syntax is correct. Based on what you have posted, I cannot see what is wrong with your code.

I should mention that I have replaced the post values in my test to:

$departement = 'Informations';
$nom = 5;
$courriel = 4;
$telephone = 7;
$message = 4;
Edited by dannon
Link to comment
Share on other sites

I'm sure you're not Pathetic, Sam.

The only parse error in what you've posted is 1] the lack of the opening PHP declaration, and 2] the "pointer" which should be a comment:

 

<--PARSE ERROR?


If the parse error you quoted:

 

syntax error, unexpected '}'
is really what the server/debugger tells you, then you didn't cut and paste the code exactly as it exists in the problem installation....
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.