Click to See Complete Forum and Search --> : Problem with Forms and POST since upgrading PHP


adamgeorge
12-21-2002, 02:41 AM
Hi, I installed the new PHP version today and are having troubles with it.

I installed the binary package for IIS, and initially it seems to be working properlly.

Now I'm having trouble with forms. I can not work out what is wrong, but it must be some sort of a configuration error I'm sure.


Here's the problem:

If I write a PHP script like so:

<form method="post" action="/script.php">
<input type="submit" value="submit">
</form>


where 'script.php' is the name of the scipt (it submits to itself), it works fine.


If I pass a variable as a parameter in the query string that's cool too:


<form method="post" action="/script.php?op=login">
<input type="submit" value="submit">
</form>



but I get the dreaded CGI error:
The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are:

if I try and pass any form elements in the script:


<form method="post" action="/script.php?op=login">
<input type="text" name="username" value="username"><br>
<input type="password" name="username"><br>
<input type="submit" value="submit">
</form>



BUT... if I change the method to GET, instead of POST, it works fine!


What is this@!@!? It's driving me nuts. I've read through countless threads in the forums here to no avail. I don't want to use GET, I want POST, and I don't see why it wouldn't work...

There's no form processing, or any syntax errors that could be causing the problem... it must be some sort of php configuration error surely.... but what? I can't find it anywhere.

This is so bizarre...

If anyone could shead some light on this for me, I would be very grateful.

Thank you,
- Adam :)

planetsim
12-21-2002, 07:41 AM
<form method="post" action="/script.php?op=login">
make the op as the name of an hidden feild and the value should equal login

then get rid of the ?op=login

and it should work.

What its trying to do is find that in your url. Thats why get is working

adamgeorge
12-21-2002, 09:14 AM
Originally posted by planetsim
<form method="post" action="/script.php?op=login">
make the op as the name of an hidden feild and the value should equal login

then get rid of the ?op=login

and it should work.

What its trying to do is find that in your url. Thats why get is working



Thanks, but it doesn't solve the problem...

There's no form processing at all... I don't use $_GET or $_POST to get the variables from the form, so I don't know if it should matter how the variables are passed in the form, esp since I have global_variables turned on.

All I'm trying to do is just simply submit a form.... it won't work with POST for some reason...


I think this new version of PHP has a few bugs in it... I might go back to the old one untill there's a more stable version that works on IIS...


thank though,
- Adam :)

David Bethel
12-21-2002, 11:05 AM
I just went through the same thing

register_globals now defaults OFF

Older stuff that used the form default GET method, needs register_globals ON or change the way you pass things

With register globals OFF

<?php header("Location: " . $_GET['username']);?>

With register_globals ON

<?php header("Location: $username");?>

Hope this helps. -David

adamgeorge
12-21-2002, 11:21 AM
Originally posted by David Bethel
I just went through the same thing

register_globals now defaults OFF

Older stuff that used the form default GET method, needs register_globals ON or change the way you pass things

With register globals OFF

<?php header("Location: " . $_GET['username']);?>

With register_globals ON

<?php header("Location: $username");?>

Hope this helps. -David


Yeah, that's what I meant by global_variables ... I just gave the wrong name. I meant I do have register_globals on.

I changed back to the older PHP, and it's still not working! I don't get it...

I've tried everything... all the user permissions are set... I've gone through the php.ini top to bottom...


basically all the problem is I can't use POST method in forms without getting the evil error : "The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are:"

GET doesn't throw this error...

I think I'm gonna reinstall IIS in a minute.... this is so pissing me off.


thanks for your reply.
- Adam :)

David Bethel
12-21-2002, 11:40 AM
It is exasperating.

I no PHP guru by any means.

Have you searched this NG with 'register_globals' It gives a lot of hits. Some responses are better than others. Sometimes answers here assume everyone has a degree in PHP coding.

Good luck -David