Page 1 of 1

Parse error: syntax error, unexpected '&'

Posted: Wed May 21, 2008 10:13 am
by farwestvillager
I don't know why I get this message: "Parse error: syntax error, unexpected '&' . . . on line 6."

Code: Select all

<?php
$title = "Quiz Results";
echo "<title>$title</title>";
if (isset ($_POST['submit'])) {
  $name = $_POST['name'];
  $q1 = "1.)" . $_POST['q1'];
  $q2 = "2.)" . $_POST['q2'];
  $q3 = "3.)" . $_POST['q3'];
  $q4 = "4.)" . $_POST['q4'];
  $q5 = "5.)" . $_POST['q5'];
  $qp = "6.)" . $_POST['qp'];
}
if ($name == "") {
  die ("You forgot something, go back and check over your quiz.");
}
if ($q1 == "1.) ") {
  die ("You forgot something, go back and check over your quiz.");
}
if ($q2 == "2.) ") {
  die ("You forgot something, go back and check over your quiz.");
}
if ($q3 == "3.) ") {
  die ("You forgot something, go back and check over your quiz.");
}
if ($q4 == "4.) ") {
  die ("You forgot something, go back and check over your quiz.");
}
if ($q5 == "4.) ") {
  die ("You forgot something, go back and check over your quiz.");
}
{
echo<<<EOT
<p>Results: $name<br>
$q1<br>
$q2<br>
$q3<br>
$q4<br>
$q5</p>
<p><a href="$qp">Go Back To Quiz?</a>
 
EOT;
}
$Name = $_POST['name'];
$Subject = "Quiz Results";
$Email = "You@mail.com";
$Message = "Here are the quiz results.";
$align = $_POST['align'];
$to = "$EmailTo";
$subject = "$Subject";
$body = "$Message\n\nQuiz By: $Name\n$q1\n$q2\n$q3\n$q4\n$q5";
mail($to,$subject,$body);
header("Location: sent.htm");
?>

Re: Parse error: syntax error, unexpected '&'

Posted: Wed May 21, 2008 4:30 pm
by Jade
I don't see anything wrong off the top of my head. Try commenting out line 6 and see if you still get the error. If you do its probably the line above causing it.