Can anyone tell me what is wrong with the script below? It works fine on one website, but i copied it and edited it for my 2nd web site (twice) and it keeps going to the errorpage and not the thankyou page, even if it is all filled in.
You can see what i mean by going to fox home page and using the contact us form. Sorry the script isnt exact, it keeps changing my addresses etc when i submit this thread. But they are correct on the original.
<?PHP
@$name = addslashes($_POST['name']);
@$email = addslashes($_POST['email']);
@$info = addslashes($_POST['info']);
// Validation for empty fields
if (strlen($name) == 0 )
{
header("Location: error");
exit;
}
if (strlen($email) == 0 )
{
header("Location: error");
exit;
}
if (strlen($info) == 0 )
{
header("Location: error");
exit;
}
$mailto = "gary@foxcovertfc.com";
$mailsubj = "Contact Us";
$mailhead = "From: $email\n";
reset ($HTTP_POST_VARS);
$mailbody = "Values submitted from web site form:\n";
while (list ($key, $val) = each ($HTTP_POST_VARS))
{
$mailbody .= "$key : $val\n";
}
mail($mailto, $mailsubj, $mailbody, $mailhead);
header("Location: thankyou");
?>
You can see what i mean by going to fox home page and using the contact us form. Sorry the script isnt exact, it keeps changing my addresses etc when i submit this thread. But they are correct on the original.
<?PHP
@$name = addslashes($_POST['name']);
@$email = addslashes($_POST['email']);
@$info = addslashes($_POST['info']);
// Validation for empty fields
if (strlen($name) == 0 )
{
header("Location: error");
exit;
}
if (strlen($email) == 0 )
{
header("Location: error");
exit;
}
if (strlen($info) == 0 )
{
header("Location: error");
exit;
}
$mailto = "gary@foxcovertfc.com";
$mailsubj = "Contact Us";
$mailhead = "From: $email\n";
reset ($HTTP_POST_VARS);
$mailbody = "Values submitted from web site form:\n";
while (list ($key, $val) = each ($HTTP_POST_VARS))
{
$mailbody .= "$key : $val\n";
}
mail($mailto, $mailsubj, $mailbody, $mailhead);
header("Location: thankyou");
?>
Comment