Multiple submits broken in PHP5

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

Threaded View

I have a page with multiple submit buttons.  Call them "ok" and
"cancel".  I have the coding in PHP as:

if (isset($ok)) { something }   and   if (isset($cancel)) { something
else }

This works fine in PHP 4.X.   In PHP5 it doesn't work at all (no action
at all).  What is the replacement coding and how can I code so that it
works in all versions of PHP?


Re: Multiple submits broken in PHP5

It should be noted that this is not an issue of PHP 4 versus 5, but rather
of different configurations (php.ini files).

You are able to access $ok and $cancel because they are automatically set as
global variables in your PHP 4 config. You should disable this - only
goodwill can stop me from submitting a form with a field called "query" set
to drop all your databases...

To do so, open your php.ini file (probably located in your PHP folder or
your Windows folder - on Windows) and change the line that reads:

register_globals = On


register_globals = Off

Now, you not be able to access $ok or $cancel directly - instead, you can
access them through the $_GET or $_POST arrays(depending on your form
method). For example, if your form method is POST, then you can use this:

if (isset($_POST["ok"])) { something }   and   if (isset($_POST["$cancel"]))
{ something else }


Re: Multiple submits broken in PHP5

On 26 May 2005 04:51:49 -0700, wrote:
Quoted text here. Click to load it

Oh man.

Firefox Web Browser - Rediscover the web - /
Thunderbird E-mail and Newsgroups - /

Site Timeline