PHP Script error

Discussion in 'PHP' started by imricky, Sep 10, 2010.

  1. #1
    Hi friends,

    I am trying to use an custom php script in my website. My aim is to redirect the user to error page when the filled form is empty or with any wrong value.

    He should go to success page when he filled the form with correct text. The correct text is for example anytext. But i am getting error constantly.

    Can anyone please check that what the error is and how to correct it?

    Any help please. Thanks in advance.
     
    imricky, Sep 10, 2010 IP
  2. Bohra

    Bohra Prominent Member

    Messages:
    12,573
    Likes Received:
    537
    Best Answers:
    0
    Trophy Points:
    310
    #2
    Wats the error ur getting
     
    Bohra, Sep 10, 2010 IP
  3. HungryMinds

    HungryMinds Active Member

    Messages:
    216
    Likes Received:
    2
    Best Answers:
    1
    Trophy Points:
    63
    #3
    Hi! Try This One.

    <?php

    // If Your Form Method="post"! U'll Use $_POST Here.
    // If Method="get"! U'll Use $_Get.
    // U Can Use $_REQUEST For Both.

    $answer = $_REQUEST['answer'];

    if ($answer != "")
    {
    header("Location: http://www.domain.com/success");
    }
    else
    {
    header("Location: http://www.domain.com/error");
    }

    ?>
     
    HungryMinds, Sep 10, 2010 IP
  4. imricky

    imricky Peon

    Messages:
    170
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I have solved this php error. i have tried to use the database with this script which solved the error. thanks a lot for the replies freinds.
     
    imricky, Sep 10, 2010 IP