|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
  [2002-08-07 00:23 UTC] dannysy at hotmail dot com
 I'm using Xitami and PHP4.2.2 I have two files form.html and sample.php. They both reside in c:\Xitami\webpages. form.html contains the ff. scripts: <html> <head> Sample </head> <body><BR> <form method=POST action="sample.php"> <input type=text name="uname" size=10> <input type=submit name="OK"> </form> </body> </html> sample.php contains the ff. scripts: <? echo "<html>"; echo "<head> Sample </head>"; echo "<body>"; echo "Name is ".$_POST['uname']."<br>"; phpinfo(); echo "</body>"; echo "</html>"; ?> After submitting form.html, you'll get the index 'uname' not defined. If you change the METHOD (in form.html) to GET and $_POST (in sample.php) to $_GET, it works fine. I also noticed that the values for all form fields can be found in the ENV array. They can be accessed as 'FORM_'+field name in caps (ie FORM_UNAME). Thanks in advance. Danny PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             | |||||||||||||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 04:00:01 2025 UTC | 
Using php.exe as CGI under WindowsXP and PHP 4.3.0 or PHP 4.2.3 leads me to same problem: Settings in PHP.ini: register_globals = On always_populate_raw_post_data = Off _POST is not initialized. CONTENT_TYPE is "multipart/form-data" What I also detect: PHP does not touch the POST data - you can read the POST data manually: $fp = fopen("php://stdin", "r"); $buf = fread($fp, $_ENV["CONTENT_LENGTH"]); echo ">>>".$buf."<<<"; Displays the complete data.K, for anyone still having a problem with this, as I had yesterday, replace the use of $_POST for the following function: function decodePost(){ $var = file_get_contents('php://input'); $postContent = explode('&',$var); for($i = 0; $i < count($postContent); $i++){ $postContent[$i] = urldecode($postContent[$i]); $map = explode('=', $postContent[$i]); $post[$map[0]] = $map[1]; } return $post; } It does not process arrays like PHP though, but still a fine workaround on an unsolved bug even on PHP 5.