#19052 [NEW]: $_POST doesn't work correctly

From: Date: Thu, 22 Aug 2002 16:05:20 +0000
Subject: #19052 [NEW]: $_POST doesn't work correctly
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-17563@lists.php.net to get a copy of this message
From: awilliam@mdah.state.ms.us Operating system: Red Hat 7.3 Linux 2.4.18 PHP version: 4CVS-2002-08-22 PHP Bug Type: Output Control Bug description: $_POST doesn't work correctly I am using PHP from http://snaps.php.net. The version I downloaded is 200208220600. I have an html file called insert_form.html and a php file called insert.php. What happens is insert_form.html gets text input from a user and then passes the user's input into a variable using METHOD=POST in the html form. Then in insert.php all it does is return the text the user submitted on insert_form.html. Below is the sample code. If you run it and look at the data returned by insert.php, for some reason, PHP is returning the value wrong. It appears to return <value><name=value>. For example if I type in PHPBUGVALUE then insert.php returns PHPBUGREPORTtestField=PHPBUGREPORT when it should just print PHPBUGREPORT. If in the code below I change METHOD=POST to METHOD=GET in insert_form.php and $_POST to $_GET in insert.php then it works fine and insert.php prints PHPBUGREPORT. Thank you for looking into the problem. <!-- insert_form.html--> <HTML> <HEAD><TITLE>Insert Form</TITLE> </HEAD> <BODY> <FORM ACTION="insert.php" METHOD="POST"> <P>Text to add:<br> <input type=text name=testField size=30> <p><input type=submit value="Insert Record"></p> </FORM> </BODY> </HTML> <!-- end insert_form.html--> <!-- insert.php --> <?php echo "the value is $_POST[testField]<BR>"; ?> <!-- end of insert.php --> -- Edit bug report at http://bugs.php.net/?id=19052&edit=1 -- Try a CVS snapshot: http://bugs.php.net/fix.php?id=19052&r=trysnapshot Fixed in CVS: http://bugs.php.net/fix.php?id=19052&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=19052&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=19052&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=19052&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=19052&r=support Expected behavior: http://bugs.php.net/fix.php?id=19052&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=19052&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=19052&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=19052&r=globals

« previous php.bugs (#17563) next »