PDA

View Full Version : Forms



squarespiro
06-11-2007, 09:36 AM
I have been over the tutorials a number of times but still can't get my form to work. I am receiving the following message:
Parse error: syntax error, unexpected '<' in /home/fgmcxow/public_html/action.php on line 178

Any suggestions?

here is the php code if that helps

<?PHP
$mailto = "chris@squaredeals.co.uk";
$email = $HTTP_POST_VARS[email];
if ($email == "") {
$email = $mailto;
}
$mailsubj = "Enquiry_Form";
$mailhead = "From: $email\n";
reset ($HTTP_POST_VARS);
$mailbody = "Values submitted from web site form :\n";
while (list ($key, $val) = each ($HTTP_POST_VARS))
{
if ($key!="submit")
{
$mailbody .= "$key : $val\n";
}
}
mail($mailto, $mailsubj, $mailbody, $mailhead);

Andy128
06-11-2007, 10:49 AM
YOU are missing the closing php tag- seen here in red.


<?PHP
$mailto = "chris@squaredeals.co.uk";
$email = $HTTP_POST_VARS[email];
if ($email == "") {
$email = $mailto;
}
$mailsubj = "Enquiry_Form";
$mailhead = "From: $email\n";
reset ($HTTP_POST_VARS);
$mailbody = "Values submitted from web site form :\n";
while (list ($key, $val) = each ($HTTP_POST_VARS))
{
if ($key!="submit")
{
$mailbody .= "$key : $val\n";
}
}
mail($mailto, $mailsubj, $mailbody, $mailhead);
?>


Andy

squarespiro
06-11-2007, 07:22 PM
Thanks Andy it sorted the problem out straight away.