Script Problem

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • Bluenose
    First Sergeant

    • Feb 2006
    • 71

    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");
    ?>
    www.hobta.co.uk

    www.floridabungalow.co.uk

    www.e-itstudy.com

    www.gpcsystems.co.uk
  • Andy128
    Major General

    • Dec 2005
    • 2317

    #2
    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!

    Comment

    • Bluenose
      First Sergeant

      • Feb 2006
      • 71

      #3
      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!
      www.hobta.co.uk

      www.floridabungalow.co.uk

      www.e-itstudy.com

      www.gpcsystems.co.uk

      Comment

      Working...
      X