I am learning PHP from a book and I m now on the stage where you make a E-mail form with custom error messages to feed back to the user if he misses out a film. However when i put it in the htdocs folder and navigate to it in my web browser i get a parse error. I have checked my code repeatedly, retyped the whole thing repeatedly, and i'am at my wits end because i have been working all day on the $#!&*)# thing!!...Could some body please look at my code and see where I have gone wrong?? It is printed below:
<HTML>
<head>
<title>All-In-One Feedback Form</title>
</head>
<body>
<?
$form_block = "
<form method=\"post\" action=\"allinone_form.php\">
<p><strong>Your Name:</strong><br>
<input type=\"text\" name=\"sender_email\" size=30></p>
<p><strong>Your E-mail Address:</strong><br>
<input type=\"text\" name=\"sender_email\" size=30></p>
<p><strong>Message:</strong><br>
<textarea name=\"message\" cols=30 rows=5 wrap=virtual>
</textarea></p>
<input type=\"hidden\" name=\"op\" value=\"ds\">
<p><input type=\"submit\" name=\"submit\" value=\"Send This Form\"></p>
</form>";
if ($POST[op] != "ds") {
//they need to see the form
echo "$form_block";
} else if ($POST[sender_name] == "ds") {
if ($POST[sender_name] == "") {
$name_err = "<font color=red>Please enter your name!</font><br>";
$send = "no";
//check value of $POST[[sender_email]
if ($POST[sender_email] == "") {
$email_err = "<font color=red>Please enter your email address!</font><br>";
$send = "no";
}
//check value of $POST[message]
if ($POST[message] == "") {
$message_err = "<font color=red>Please enter a message!</font><br>";
$send = "no";
} if ($send != "no") {
//its ok to send!
$to = "kaliber_rnb_thug2k@hotmail.com";
$subject = "All-In-One Web Site Feedback";
$mailheaders = "From: My Web Site <> \n";
$mailheaders .= "Reply To: $POST[sender_email]\n\n";
$msg = "E-MAIL SENT FROM WWW SITE\n";
$msg .= "Sender Name: $POST[sender_name]\n";
$msg .= "Sender's E-mail: $POST[sender_email]\n";
$msg .= "Message: $_POST[message]\n\n";
mail($to, $subject, $msg, $mailheaders);
echo "<p>Mail has been sent!</p>";
} else if ($send == "no") {
echo "$name_err";
echo "$email_err";
echo "$message_err";
echo "$form_block";
}
}
</body>
</HTML>
?>
Thanks