PHP5 submit value problem

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
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="thispage.php">
<input type="text" name="name" size="40">
<input type="submit" name="runquery" value="submitname">

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?

Re: PHP5 submit value problem

Your previous installation used global_variables (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))
        else if (!empty($HTTP_GET_VARS))

        if (!empty($_POST))
        else if (!empty($HTTP_POST_VARS))

Re: PHP5 submit value problem

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

Site Timeline