|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #18765 FORM POST fields are missing
Submitted: 2002-08-07 00:23 UTC Modified: 2002-10-17 01:00 UTC
Avg. Score:4.6 ± 0.6
Reproduced:17 of 17 (100.0%)
Same Version:5 (29.4%)
Same OS:1 (5.9%)
From: dannysy at hotmail dot com Assigned:
Status: No Feedback Package: *General Issues
PHP Version: 4.2.2 OS: Windows 95
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [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:
<head> Sample </head>
<form method=POST action="sample.php">
<input type=text name="uname" size=10>
<input type=submit name="OK">

sample.php contains the ff. scripts:
echo "<html>";
echo "<head> Sample </head>";
echo "<body>";

echo "Name is ".$_POST['uname']."<br>";


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.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-08-07 14:58 UTC]
Might be related to #18792
 [2002-08-11 23:40 UTC] dannysy at hotmail dot com
I'm not sure, but I don't think it's related to "multipart/form-data".  I've added the line phpinfo() to the sample.php scrift.  The content-type reported by phpinfo is "application/x-www-form-urlencoded".  I may be wrong as I'm a newbie to PHP =)
 [2002-08-19 23:45 UTC] dannysy at hotmail dot com
It has already been two weeks since I posted this.  Is there anyone out there who can help me with this problem?  Please =)
 [2002-10-01 20:39 UTC]
Please try using this CVS snapshot:
For Windows:

 [2002-10-17 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over 2 weeks, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2002-11-05 14:04 UTC] nylbog at freemail dot hu
Having the same problem under winXP PHP 4.2.3
 [2002-12-15 14:43 UTC] markus at markus dot dom dot de
i have the same problem with apache 2.0.43 and php-4.3rc3

checkout here:

if you like.

 [2003-02-04 16:26 UTC] s dot franke at bebbosoft dot de
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.
 [2008-06-04 13:35 UTC] alex at alexmreis dot com
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.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Feb 29 03:01:27 2024 UTC