Bug #18088 Updated: $_GET variables are improper set when POST form submittion follows GET method
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)