PDA

View Full Version : Script Problem



Bluenose
07-07-2006, 10:01 PM
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 (http://www.foxcovertfc.com) 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 (http://www.foxcovertfc.com/errorpage.html)");
exit;
}
if (strlen($email) == 0 )
{
header("Location: error (http://www.foxcovertfc.com/errorpage.html)");
exit;
}
if (strlen($info) == 0 )
{
header("Location: error (http://www.foxcovertfc.com/errorpage.html)");
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 (http://www.foxcovertfc.com/thankyou.html)");
?>

Andy128
07-07-2006, 10:47 PM
Well- the one thing I noticed is that your filed "Info" on the form is spelled with a lowercase "info" in the script. There the script is looking for a field named "info" and not finding it. Try fixing that and seeing if it works.

I would change the field name in the form to "info" and then save/publish
rather than modify the php script.

Andy

Bluenose
07-09-2006, 03:03 PM
Ahhhhhhhhhhhhhhhhhhhh, you would not believe how long i played with this and THAT was the problem? Thanks again mate, ur attention to details is second to none.

That was the problem. There was me thinking all my hard work in learning scripts was rubbish, and it was a capital i stopping me in my tracks.

Cheers mate!