Bug #18088 Updated: $_GET variables are improper set when POST form submittion follows GET method

From: Date: Mon, 01 Jul 2002 13:52:36 +0000
Subject: Bug #18088 Updated: $_GET variables are improper set when POST form submittion follows GET method
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-12646@lists.php.net to get a copy of this message
 ID:               18088
 Updated by:       hholzgra@php.net
 Reported By:      gryaznov@guta.ru
 Status:           Bogus
 Bug Type:         Variables related
 Operating System: Win2K (at least)
 PHP Version:      4.2.1
 New Comment:

guess you wanted to assign 'test.php' to the form *action* not *name*?

'cause now, as you do not specify any action,
it defaults to the page GET url, including parameters ...


Previous Comments:
------------------------------------------------------------------------

[2002-07-01 09:32:05] sniper@php.net

This is actually a feature rather than bug.

When you load the script first time, the get line 
does not have '?start=1' in it. Now, when you press the
NOTSET button, it won't be set.

But when you press SET button, the url will get '?start=1'
and when you then press NOTSET, it will add it to $_GET
array. 

This is very good reason why you should use $_GET / $_POST 
arrays and set register_globals=off



------------------------------------------------------------------------

[2002-07-01 09:07:21] gryaznov@guta.ru

Here is the test (file test.php):

<HTML>
<BODY>
<FORM NAME=test.php METHOD=GET>
<INPUT TYPE=HIDDEN NAME=start value=1>
<INPUT TYPE=SUBMIT VALUE=SET>
</FORM>
<FORM NAME=test.php METHOD=POST>
<INPUT TYPE=SUBMIT VALUE=NOTSET>
</FORM>
<BR>
start value is: <?php echo $start ?><BR>
</BODY>
</HTML>

When you click "set" button in browser, $start variable will be 1, when
you click "notset" button after clicking "set" $start variable will be
1 also. Note: if register_globals is off you will need to use
$_GET["start"] instead of $start, but it works also. (Though the method
was POST, $_GET start variable should not be set)

------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=18088&edit=1



Thread (5 messages)

« previous php.bugs (#12646) next »