Current time: 04-18-2014, 08:40 AM Hello There, Guest! (LoginRegister)

Post Reply 
$_POST empty
08-26-2009, 07:55 AM
Post: #1
$_POST empty
I have a page that posts form values to another page that worked in January, and doesn't work anymore. It hasn't been used since January, now it needs to be used again. No code had changed, and a search led me to believe that I needed to change my $HTTP_POST_VARS to $_POST. I did this, and now the $_POST array comes empty.

What's really strange to me is that if I output $_REQUEST, I get everything that I would expect, all my $_GET, $_POST, and $_COOKIE, as the documentation suggests. But then I output each of $_GET, $_POST, and $_COOKIE separately, and the $_POST is empty. The other two are correct.

For now I will use $_REQUEST since it has all my posted values. Is there a setting that I need to change to make the $_POST variable work?
Find all posts by this user
Quote this message in a reply
08-26-2009, 10:09 AM
Post: #2
$_POST empty
Quote:For now I will use $_REQUEST since it has all my posted values. Is there a setting that I need to change to make the $_POST variable work?
First things first - let's check the value of $_SERVER['REQUEST_METHOD'] because if it is not 'POST' we should expect $_POST to be empty.

Quote:What's really strange to me is that if I output $_REQUEST, I get everything that I would expect, all my $_GET, $_POST, and $_COOKIE, as the documentation suggests. But then I output each of $_GET, $_POST, and $_COOKIE separately, and the $_POST is empty. The other two are correct.
Let's see.

$_GET + $_POST + $_COOKIE = $_REQUEST

If we don't post anything we are left with

$_GET + $_COOKIE = $_REQUEST

Doesn't seem strange at all.

Customer since 2000 Cool openvein.org
Visit this user's website Find all posts by this user
Quote this message in a reply
09-02-2009, 07:49 AM
Post: #3
$_POST empty
Perhaps I was not clear.

I shall state it another way: If I add the sizes of each array: $_GET + $_POST + $_COOKIE, the sum is 2+0+5=7.

But if I look at the size of the $_REQUEST array, it is 15, and includes all 8 items I post on the form.

So, as you can see, $_GET + $_POST + $_COOKIE != $_REQUEST, which is why I found it strange, and still do.

And yes, the value of $_SERVER['REQUEST_METHOD'] is 'POST'.

I will continue to ignore the $_POST variable since it doesn't work for me at this time.
Find all posts by this user
Quote this message in a reply
09-02-2009, 11:53 AM
Post: #4
$_POST empty
Quote:I will continue to ignore the $_POST variable since it doesn't work for me at this time.
$_POST should work fine with the default install of PHP 5 by DreamHost. Perhaps you can figure out the what the problem is later when you can reduce your code to a testcase.

Customer since 2000 Cool openvein.org
Visit this user's website Find all posts by this user
Quote this message in a reply
09-02-2009, 07:22 PM
Post: #5
$_POST empty
I'm aware of how $_POST *should* work, via a simple Google search. So that isn't much help. A testcase is what I started with of course. I posted my problem on another PHP board and have received several much more helpful leads that I'll look into in the morning. It looks like nothing much will come from this thread. Thanks anyway for letting me know how $_POST should work.
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump: