Page 1 of 1

$_POST array is empty

Posted: Sun Nov 13, 2011 7:54 pm
by counterlink
I cannot get a submitted form to be put in the $_POST array. The raw string is passed, but $_POST remains empty. To try debugging I tried the minimal example below. Each time I submit, the print_r produces ARRAY()

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

<html>
<head>
<title>I</title>
</head>

<body>
<?php print_r($_POST); ?>
<form action="temp.php" method="post">
<label>User ID:</label><input name="userid" size="16" type="text" >
<label>Password:</label><input name="password" size="16" type="password"><br><br>
<input name="submit" type="submit" value="Submit">
</form>
</body>
</html>

I tried using the GET method and have the same problem. I see the parameters correctly in the URL display of the browser, but the $_GET array is empty.

Re: $_POST array is empty

Posted: Sun Nov 13, 2011 8:00 pm
by twinedev
Assuming that the code above IS temp.php, then sounds like you have a problem with the server. Just to make sure that I'm not missing something because I'm tired, I just threw your code on my server and it worked fine, once I filled out the form and hit submit, $_POST had the correct info.

-Greg

Re: $_POST array is empty

Posted: Sun Nov 13, 2011 9:39 pm
by counterlink
Thanks friend.
I am runnng the development server within Expression Web 4. And I just discovered what I need to do to get it to work.
In php.ini I need to set
doc_root = localhost
cgi.force_redirect = 0

Through trial and error this fixed the problem.