#17897 [Com]: POST form variables are empty

From: Date: Fri, 06 Sep 2002 19:05:21 +0000
Subject: #17897 [Com]: POST form variables are empty
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-18585@lists.php.net to get a copy of this message
ID: 17897 Comment by: Boris@CrazySnowBoarder.com Reported By: hofmann@isl.org Status: Bogus Bug Type: Apache related Operating System: Linux PHP Version: 4.2.1 New Comment: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Untitled</title> </head> <body> <form name="form" action="t.php" method="post"> <input type="text" name="x"><input type="submit" name="submit"> </form> </body> </html> <? echo $_POST["x"]; echo $x; ?> both echo are empty... oh yea and file is called t.php... and i have gloabal = on and populoating varibles with post data... help... Previous Comments: ------------------------------------------------------------------------ [2002-07-09 18:22:00] sniper@php.net Not really bug (in PHP). If '/' is not added, then a redirection is done to the / address..and of course the post data is lost. Using that kind of urls in "action" field is not very wise.. ------------------------------------------------------------------------ [2002-07-09 14:09:09] mrjones@email.it This workaround works: Sending the value called a from a form: $string = $_POST["a"]; Apache 2.0.39 & php 4.2.1 ------------------------------------------------------------------------ [2002-07-08 22:32:31] philip@php.net Confirmed designer_7@yahoo.com example, of action="foo/" vs action="foo", and lost POST values for the latter. With Apache1 and GET working both ways. I'm not sure about the apache2/post bug. Is this a php-dev, phpdoc, or apache bug? ------------------------------------------------------------------------ [2002-07-08 19:51:42] designer_7@yahoo.com I believe I can reproduce this problem. However, if I am correct, I don't know if this is "intended" to be or if it should be considered a bug with PHP4 or Apache. suppose you have a file http://server/somedir/index.php and you've configured apache to use index.php for the index page. if your form looks like: <form action="http://server/somedir/" method="post"> it DOES WORK. However if you have a form like: <form action="http://server/somedir" method="post"> Even though Apache knows to pull up the /server/somedir/index.php page, the POST variables don't make it to the page and $_POST is completely empty. If using GET, both forms above work fine, i.e., http://server/somedir/?key1=val1&key2=val2 and http://server/somedir?key1=val1&key2=val2 behave identically. Would this be considered an Apache problem then? Or does it have something to do with PHP4 interaction with Apache? I don't know where this should be fixed... but I struggled with this for a several days and this is my finding. Hope it's of some value... ------------------------------------------------------------------------ [2002-06-21 08:57:44] hofmann@isl.org This bug is well known and has been reported earlier! But as it seems it has been removed from the databse, maybe it was not possible to make it Apache 2 related! The information reported is enough - I am sure you can do a small test yourself: <form method="post" action="test.php"> <input type="text" name="test" value="123" /> <input type="submit" name="submit"> </form> test.php <?php echo ":" . $_POST["test"] . ":"; ?> there is no result echoed! Just fix it - because I don't want to report this a third time - others have reported this also! ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/17897 -- Edit this bug report at http://bugs.php.net/?id=17897&edit=1

« previous php.bugs (#18585) next »