+ Reply to Thread
Results 1 to 3 of 3

Thread: Script Problem
      
   

  1. #1
    Bluenose is offline First Sergeant
    Join Date
    Feb 2006
    Location
    Edinburgh
    Posts
    71

    Default Script Problem

    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");
    ?>

  2. #2
    Andy128's Avatar
    Andy128 is offline Major General
    Join Date
    Dec 2005
    Location
    Michigan
    Posts
    2,322

    Default Re: Script Problem

    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
    PHP- is a blast!

  3. #3
    Bluenose is offline First Sergeant
    Join Date
    Feb 2006
    Location
    Edinburgh
    Posts
    71

    Default Re: Script Problem

    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!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49