$_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.
<head>
    <title>TEST</title>
</head>
<body>
   <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" />
   </form>
</body>
</html>
-----------------------------------------
posttest.php
 
<?php
print_r($_POST);
?>

Open in new window

NAFiamengoAsked:
Who is Participating?
 
NAFiamengoAuthor Commented:
Another clue -
http://localhost/...  DOES NOT WORK
http://127.0.0.1/... DOES WORK
0
 
EthienCommented:
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

0
 
Roger BaklundCommented:
Can't see anything wrong with your code. Which php version?
0
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.
0
 
Roger BaklundCommented:
On php4.0 and earlier $_POST was not available, we used deprecated variable $HTTP_POST_VARS.
0
 
shobinsunCommented:
Hello,

For more about post and get go through the links:

http://www.tizag.com/phpT/postget.php

http://www.careerride.com/PHP-GET-POST.aspx

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.

Regards.


0
 
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.
0
 
Roger BaklundCommented:
Case matters, it must be $_POST, not $_Post or $_post.
0
 
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...
0
 
NAFiamengoAuthor Commented:
I created an ASP script to get the data -  
<%@ Language=VBScript %>
<% option explicit %>
<%Response.Buffer=True%>
<HTML>
<HEAD><TITLE>TEST</TITLE></HEAD>
<BODY>
<p>
<%
Response.Write Request("Text1")
%>
</p>
</BODY>
</HTML>
-------------------------
GET works, POST doesn't. What could be wrong with IIS causing this?
0
 
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
0
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.