PHP5 submit value problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • niraj.sanghvi@gmail.com

    #1

    PHP5 submit value problem

    I just upgraded to PHP5 from PHP4, and most of the transition was
    seamless. But my forms don't appear to be working correctly now. Where
    I have the following:

    if($runquery) { Use $POST values... }
    else {
    <form name="thequery" method="post" action="thispag e.php">
    Query:<br>
    <input type="text" name="name" size="40">
    <br><br>
    <input type="submit" name="runquery" value="submitna me">
    </form>
    }


    where the first part checks if the form was submitted (it sends the
    post values back to the same page), and otherwise displays the form. In
    PHP4 this worked fine. In PHP5, it is displaying the form over and
    over. The ($runquery) condition is never met. I could change it to
    check if(isset($_POST['name'])), but I would like to avoid changing
    large amounts of code if I can.

    Any suggestions?

  • onedbguru@firstdbasource.com

    #2
    Re: PHP5 submit value problem

    Your previous installation used global_variable s (in php.ini), the
    default is ON. In Version 4 and later, the default is OFF.

    For tightened security purposes use the default and change your code.

    if you don't want to change your code you can always add this code
    snippet to the begining of your existing scripts:

    if (!empty($_GET))
    {
    extract($_GET);
    }
    else if (!empty($HTTP_G ET_VARS))
    {
    extract($HTTP_G ET_VARS);
    }

    if (!empty($_POST) )
    {
    extract($_POST) ;
    }
    else if (!empty($HTTP_P OST_VARS))
    {
    extract($HTTP_P OST_VARS);
    }

    Comment

    • niraj.sanghvi@gmail.com

      #3
      Re: PHP5 submit value problem

      Thanks for the quick response! That last part worked perfectly.

      Comment

      Working...