Page 1 of 1
variable chopped when using POST method, but not GET :?
Posted: Thu Aug 08, 2002 5:04 am
by gratou
I am totally at lost with this one.
When I change from using GET to using POST, the last character of the value typed in the single variable in my form gets chopped off.
I dumped the $GLOBALS and $_POST arrays and they contain the same truncated value.
GET transmits it with no loss. Any idea?
Thank you!
Posted: Thu Aug 08, 2002 5:20 am
by twigletmac
Could you post the code you've been using. Some info about your setup might be useful too, ie. which version of PHP, which OS, which webserver.
On a side note, please check before you start a new topic which forum you're in because I not too sure what this has to do with databases...
Mac
Oooops!
Posted: Thu Aug 08, 2002 5:48 am
by gratou
Sorry, please delete the thread, I'll ask in the right place.

Posted: Thu Aug 08, 2002 5:50 am
by twigletmac
No it's ok I've already moved it

. I really should have said that, sorry.
Mac
Continued
Posted: Thu Aug 08, 2002 6:01 am
by gratou
Thank you for moving it.
My code is very straight forward:
- a form with method="post"
- a field called Userid
- a submit button
When I read the value returned in my PHP script, it is truncated if post is used, not with get.
Something else is changed: if I type a < character in the field, it is left alone by get, but post changes it to %3 (truncation of %3C, the code for <). Strange hey?
I am using PHP 4.2.1 on W98.
Please!!
Posted: Sun Aug 11, 2002 12:36 am
by gratou
Please people, I am sure one of you has an idea. Please...
Posted: Sun Aug 11, 2002 12:59 am
by fatalcure
can u post the code?
Posted: Sun Aug 11, 2002 5:17 am
by gratou
Here is the code, but I think you'll be disappointed:
HTML
Code: Select all
<form action="{$PHP_SELF}" method="post">
<tr><td valign="top" >Login: </td>
<td><input name="Userid" id="Userid" maxlength="16" size="16">
PHP
Code: Select all
while (list($name,$value) = each($_GET)) {echo "ggggggget $name=$value<br>\n";}
while (list($name,$value) = each($_POST)) {echo "ppppppp $name=$value<br>\n";}
changing the form's method means the _post and _get arrays' contents change. Except the _POST array contains a truncated $Userid variable.
This is probably something to do with PHP's (or apache's?) setup as I discovered even phpmyadmin is crippled and doesn't pass parameters right (database names get truncated).
Thanks again very much for your insight.
Posted: Sun Aug 11, 2002 12:05 pm
by MattF
Try removing the maxlength on your text field, it might also be something to do with the browser...
Posted: Tue Aug 20, 2002 4:09 am
by gratou
I just reinstalled the whole of php and it now works.
Thank you all.