By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,313 Members | 1,113 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,313 IT Pros & Developers. It's quick & easy.

Problem with POST variables (PHP5)

P: n/a
Hey everyone,

I'm on a server running PHP 5.0.5 but we've discovered that there's a
problem with it. We cannot create a form with method "POST" because it
simply will not post the form data (using HTML 4.01 Strict).

If we switch the method to a "GET", it _will_ work! Would anyone here be
able to explain it? I've already sent a message to our host but more out
of curiousity, I want to know if anyone else has experienced this before.

An example is here: http://www.webmarkdesigns.com.au/my_test.php5

You'll notice: Array ( )
which represents a print_r($_REQUEST) call - press the submit button and
see what happens!

Thanks for your help in understanding this,
Nicko.
Feb 7 '06 #1
Share this Question
Share on Google+
9 Replies


P: n/a
On Tue, 07 Feb 2006 01:57:36 +0000, Nicko wrote:
Hey everyone,

I'm on a server running PHP 5.0.5 but we've discovered that there's a
problem with it. We cannot create a form with method "POST" because it
simply will not post the form data (using HTML 4.01 Strict).

If we switch the method to a "GET", it _will_ work! Would anyone here be
able to explain it? I've already sent a message to our host but more out
of curiousity, I want to know if anyone else has experienced this before.

An example is here: http://www.webmarkdesigns.com.au/my_test.php5

You'll notice: Array ( )
which represents a print_r($_REQUEST) call - press the submit button and
see what happens!

Thanks for your help in understanding this,
Nicko.

What does print_r return if you access $_POST directly?

Feb 7 '06 #2

P: n/a
Steve wrote:
What does print_r return if you access $_POST directly?


The exact same thing...
Feb 7 '06 #3

P: n/a
It could be that your host has the variables_order directive in the
php.ini file is mis-configured. It usually defaults to "EPGCS". If you
run the code below and find that "P" is missing then this is the
problem. This directive can be set in php.ini, .htaccess or httpd.conf.

$order = ini_get('variables_order');
print $order;

Feb 7 '06 #4

P: n/a
samudasu wrote:
If you run the code below and find that "P" is missing then this is the
problem. This directive can be set in php.ini, .htaccess or httpd.conf.


Okay, ran the code and the only difference is that the P is set _after_
the G...

EGPCS instead of EPGCS

Could that be the problem? And how would I set that in an .htaccess file
(I thought that was only for Apache configuration)?
Feb 7 '06 #5

P: n/a
EGPCS is the correct default, sorry for the typo. There are several PHP
directives that can be set in httpd.conf and .htaccess files but it
doesn't seem variables_order is the problem in this case although you
can try.
http://us2.php.net/configuration.changes

Feb 7 '06 #6

P: n/a
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Nicko wrote:
I'm on a server running PHP 5.0.5 but we've discovered that there's a
problem with it. We cannot create a form with method "POST" because it
simply will not post the form data (using HTML 4.01 Strict). The browser is posting the data, that's not the problem.
You'll notice: Array ( )
which represents a print_r($_REQUEST) call - press the submit button and
see what happens!


You might as well replace that with a call to phpinfo(); . Not very clean,
but you'll get the contents of every defined superglobal cariable.

- --
- ----------------------------------
Iván Sánchez Ortega -i-punto-sanchez--arroba-mirame-punto-net

Envejecer es el único medio de vivir mucho tiempo.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQFD6GEW3jcQ2mg3Pc8RAslBAJwOAfTis6g5iSTmsKpK8E QaK75ylQCdGd30
sH78msMnaOW2igVLcAcB5cg=
=hsV5
-----END PGP SIGNATURE-----
Feb 7 '06 #7

P: n/a
Iván Sánchez Ortega wrote:
You might as well replace that with a call to phpinfo(); . Not very clean,
but you'll get the contents of every defined superglobal cariable.


hmm... Probably wouldn't be willing to do that but I did discover that
it may have been a bug in some earlier versions of PHP 5 [we are using
5.0.5] - http://bugs.php.net/bug.php?id=31417

Could this be the problem? I'll send this to my host anyway and let them
play with it.

Thanks for everyone's responses.

Nicko.
Feb 7 '06 #8

P: n/a
it doesn't look like you are using HTML strict like you were saying. in
fact, there is no DTD. you should try using one, not that it would help
much.
This is what I saw for HTML. You shouldn't be outputting stuff before HTML
element anyway.

I tried this form and look what I got...
Array ( [abc] => 123 )
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-

transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>test me</title>
</head>

<body>
<form action="http://www.webmarkdesigns.com.au/my_test.php5?abc=123"
method="post">
<input type="text" name="txtMe" value="Test">
<input type="submit" value="Submit">
</form>
</body>
</html>

you appear to be using $_GET[] or $_REQUEST[], not $_POST[] in your
print_r().

"samudasu" <sa******@hotmail.com> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...
EGPCS is the correct default, sorry for the typo. There are several PHP
directives that can be set in httpd.conf and .htaccess files but it
doesn't seem variables_order is the problem in this case although you
can try.
http://us2.php.net/configuration.changes

Feb 12 '06 #9

P: n/a
Jim Michaels wrote:
it doesn't look like you are using HTML strict like you were saying. in
fact, there is no DTD. you should try using one, not that it would help
much.
This is what I saw for HTML. You shouldn't be outputting stuff before HTML
element anyway.


Take my word for it, it doesn't make a difference. We've been tackling
this problem for a while now and there's simply been no solution.
Currently, we're trying to use an intermediary PHP4 script to put all
the post variables in the $_SESSION array so that we can use them later.
That seems to be the best solution, just not sure if PHP4 will share
it's $_SESSION array with PHP5...

Nick.
Feb 12 '06 #10

This discussion thread is closed

Replies have been disabled for this discussion.