$_POST array empty

When receiving data from HTML forms I can receive data in the $_GET array when the form uses the GET action. When I switch the form to the POST action my $_POST array is empty.
   <form method="post" name="post1" id="post1" action="posttest.php"> 
    <input id="Text1" type="text" name="Text1" />
   <input id="Submit1" type="submit" value="submit" name="Submit1" />

Open in new window

Who is Participating?
NAFiamengoAuthor Commented:
Another clue -
http://localhost/...  DOES NOT WORK DOES WORK
Trying grabbing the tag with the post array.

It maybe you have to specify a name IE the name of the data being sent in your case 'Text1'

echo $_POST['Text1'];

Open in new window

Roger BaklundCommented:
Can't see anything wrong with your code. Which php version?
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

Guy Hengel [angelIII / a3]Billing EngineerCommented:
that is "impossible".

I presume that the page you test with is still "in cache" of your browser, aka with the form=>get settings.
try to force-refresh the page, and retry.
Roger BaklundCommented:
On php4.0 and earlier $_POST was not available, we used deprecated variable $HTTP_POST_VARS.

For more about post and get go through the links:



And if you use 'get' method in the action and use  'print_r($_POST);', then you will get the array with values. And when you use 'post' method and print_r($_POST);, then you will get the same result.

And also, if you use print_r($_GET); and get method , you wil get empty array.


NAFiamengoAuthor Commented:
PHP 4.3.1 is my version. The code works on another machine running 4.3.1. I am double checking that I am matching GETS and POSTS in the 2 files. I am making sure by using view souce that I am not using a cached copy of the html file. Any more ideas? I agree this should not be.
Roger BaklundCommented:
Case matters, it must be $_POST, not $_Post or $_post.
Guy Hengel [angelIII / a3]Billing EngineerCommented:
another option would be that the php on the server where it does not work is not configured correctly in regards to the session data folder on the server.
I had that once on a hosted server, where it took me 2 weeks to convince the host admin to have a look at the sessions, after which I just got this as answer:
<homer_voice> duh!! </homer_voice>
so, I don't know what the setting was...
NAFiamengoAuthor Commented:
I created an ASP script to get the data -  
<%@ Language=VBScript %>
<% option explicit %>
Response.Write Request("Text1")
GET works, POST doesn't. What could be wrong with IIS causing this?
Guy Hengel [angelIII / a3]Billing EngineerCommented:
found this one: http://support.microsoft.com/kb/308074
The POST Method Does Not Work If You Are Using Kerberos Authentication
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.