View Full Version : Parse error: syntax error, unexpected T_VARIABLE in

11-01-2006, 07:46 PM
Here is my form.html:
<form action="sendreserv.php" method="post">
<input name="rname" type="text" class="svform">
<input name="remail" type="text" class="svform">
<input type="text" name="rtel" class="svform">
<p>Nombre d'adultes:
<select name="rnbradult" size="" class="svform">
<option value="1" selected>1 personne</option>
<option value="2">2 personnes</option>
<option value="3">3 personnes</option>
<option value="4">4 personnes</option>
<option value="5">5 personnes et +</option>
Nombre d'enfants:
<select name="rnbrkid" class="svform">
<option value="0" selected>Aucun</option>
<option value="1">1 enfant</option>
<option value="2">2 enfants</option>
<option value="3">3 enfants</option>
<option value="4">4 enfants</option>
<input name="rlevel" type="radio" value="1"><br>
<input name="rlevel" type="radio" value="2"><br>
<input name="rlevel" type="radio" value="3"></p>
<p>Debut des cours: <select name="rday" class="svform">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="17">17</option>
<option value="18">18</option>
<option value="19">19</option>
<option value="20">20</option>
<option value="21">21</option>
<option value="22">22</option>
<option value="23">23</option>
<option value="24">24</option>
<option value="25">25</option>
<option value="26">26</option>
<option value="27">27</option>
<option value="28">28</option>
<option value="29">28</option>
<option value="30">30</option>
<option value="31">31</option>
<select name="rmonth" class="svform">
<option value="J">Jan</option>
<option value="F">Fev</option>
<option value="M">Mar</option>
<option value="A">Avr</option>
<option value="M">Mai</option>
<option value="J">Juin</option>
<option value="J">Juil</option>
<option value="A">Aou</option>
<option value="S">Sept</option>
<option value="O">Oct<option>
<option value="N" selected>Nov</option>
<option value="D">Dec</option>
<select name="ryear" class="svform">
<option value="06">2006</option>
<option value="07">2007</option>
<option value="08">2008</option>
<option value="09">2009</option>
<label>Informations supplementaires: <br>
<textarea name="rinfos" cols="35" rows="10" class="svform"></textarea>
<input name="submit" type="submit" value="Envoyer ">
<input name="erase" type="reset" value="Effacer ">

Here is the sendreserv.php

$mailto = 'email@url.com' ;

$subject = "Reservation form" ;

$formurl = "http://www.url.com/fr/main.php?page=reserv" ;
$errorurl = "http://www.url.com/error.html" ;
$thankyouurl = "http://www.url.com/thankyou.html" ;

// -------------------- END OF CONFIGURABLE SECTION ---------------

$name = $_POST['rname'] ;
$email = $_POST['remail'] ;
$tel = $_POST['rtel'] ;
$nbradult = $_POST['rnbradult'] ;
$nbrkid = $_POST['rnbrkid'] ;
$level = $_POST['rlevel'] ;
$day = $_POST['rday'] ;
$month = $_POST['rmonth'] ;
$year = $_POST['ryear'] ;
$infos = $_POST['rinfos'] ;
$http_referrer = getenv( "HTTP_REFERER" );

if (!isset($_POST['remail'])) {
header( "Location: $formurl" );
exit ;
if (empty($name) || empty($email) || empty($tel)) {
header( "Location: $errorurl" );
exit ;
$name = strtok( $name, "\r\n" );
$email = strtok( $email, "\r\n" );
if (get_magic_quotes_gpc()) {
$tel = stripslashes( $tel );

$messageproper =

"This message was sent from:\n" .
"$http_referrer\n" .
"------------------------- COMMENTS -------------------------\n\n" .
Nom $name
Email $email
Telephone $tel
Adultes $nbradult
Enfant $nbrkid
Niveau $level
Date $day $month $year
Informations supplementaires $infos

"\n\n------------------------------------------------------------\n" ;

mail($mailto, $subject, $messageproper, "From: \"$name\" <$email>\r\nReply-To: \"$name\" <$email>\r\nX-Mailer: sendreserv.php 2.04" );
header( "Location: $thankyouurl" );
exit ;


What's wrong in that?
I think the problem is around my <selected> & <option> tags.
But why i always get an unexpected T_VARIABLE error?

Thanks in advance!

11-01-2006, 07:50 PM
Its this part

$messageproper =

"This message was sent from:\n" .
"$http_referrer\n" .
"------------------------- COMMENTS -------------------------\n\n" .
Nom $name
Email $email
Telephone $tel
Adultes $nbradult
Enfant $nbrkid
Niveau $level
Date $day $month $year
Informations supplementaires $infos

"\n\n------------------------------------------------------------\n" ;
Your strings aren't strings because you concatenate them just after your newline characters. Try this instead

$messageproper =

"This message was sent from:\n" .
"$http_referrer\n" .
"------------------------- COMMENTS -------------------------\n\n" .
"Nom ".$name."\r\n".
"Email ".$email."\r\n".
"Telephone ".$tel."\r\n".
"Adultes ".$nbradult."\r\n".
"Enfant ".$nbrkid."\r\n".
"Niveau ". $level."\r\n".
"Date ".$day." ".$month." ".$year."\r\n".
"Informations supplementaires".$infos."\r\n".

"\n\n------------------------------------------------------------\n" ;

11-01-2006, 08:12 PM
Thank you!