Connecting Tech Pros Worldwide Forums | Help | Site Map

$_POST is empty (in MSIE?)

Rudolf Horbas
Guest
 
Posts: n/a
#1: Jul 17 '05
G'day,

has any of You ever experienced the problem that posted forms deliver an
empty $_POST-array?

I have a form like:

<form method="POST" action="https://.../result.html?qid=70">
<input type="checkbox" value="1" name="1a">
<input type="checkbox" value="1" name="1b">
(...)
<input type="submit" name="Answer" value="Answer">
</form>

and every once in a while I get empty results (1 out of 10, maybe). This
only happens in MSIE 6.0, as far as I can see, but I'm not absolutely sure.
Some users have the problem all the time, some never.

I use https to connect and mod_rewrite to rewrite "result.html" to
"result.php"...

SERVER_SOFTWARE:
Apache/1.3.27 (Unix) PHP/4.3.1 mod_ssl/2.8.12 OpenSSL/0.9.6g

Beats me ... help _very_ appreciated.

Rudi

Pedro Graca
Guest
 
Posts: n/a
#2: Jul 17 '05

re: $_POST is empty (in MSIE?)


Rudolf Horbas wrote:[color=blue]
> G'day,[/color]

Thank you, g'night :)
[color=blue]
> every once in a while I get empty results (1 out of 10, maybe). This
> only happens in MSIE 6.0, as far as I can see, but I'm not absolutely sure.
> Some users have the problem all the time, some never.[/color]

I guess it happens when there is no info to POST *and* the user
does not click the submit button but presses ENTER instead.

This also happens with Mozilla Firebird. I tested with:

<?php
echo <<<HTML
<form action="{$_SERVER['PHP_SELF']}" method="post">
<input type="checkbox" name="chk1" value="1" checked/>box 1<br/>
<input type="checkbox" name="chk2" value="2"/>box 2<br/>
<input type="submit" name="submit" value="Go!"/>
</form>
HTML;
if (isset($_POST)) {
echo "<pre>\n\n\n"; print_r($_POST); echo '</pre>';
}
?>

==> uncheck box 1 (with the mouse) and press ENTER
--
--= my mail box only accepts =--
--= Content-Type: text/plain =--
--= Size below 10001 bytes =--
Rudolf Horbas
Guest
 
Posts: n/a
#3: Jul 17 '05

re: $_POST is empty (in MSIE?)


> Thank you, g'night :)

It's night over here, too :-)
[color=blue]
> I guess it happens when there is no info to POST *and* the user
> does not click the submit button but presses ENTER instead.
> (...)[/color]

I'm afraid that's not the problem. The users have _definitely_ checked
some boxes.
I also have a <hidden>-field that does not get through.

$_POST gets lost somewhere in cyberspace ...

*sigh*
Rudi
(off to bed)
Geoff Berrow
Guest
 
Posts: n/a
#4: Jul 17 '05

re: $_POST is empty (in MSIE?)


I noticed that Message-ID: <c1glqh$n7a$1@svr7.m-online.net> from Rudolf
Horbas contained the following:
[color=blue]
>I have a form like:
>
><form method="POST" action="https://.../result.html?qid=70">
> <input type="checkbox" value="1" name="1a">
> <input type="checkbox" value="1" name="1b">
> (...)
> <input type="submit" name="Answer" value="Answer">
></form>[/color]

Can't help with the intermittent thing but while I was checking this out
I was lazy (I have register_globals on) and wrote this

<form method="POST" action="<?php print $PHP_SELF; ?>">
<input type="checkbox" value="1" name="1a">
<input type="checkbox" value="1" name="1b">
<input type="submit" name="Answer" value="Answer">
</form>
<?php
print $1a;
print $1b;
?>

Doesn't work. Gives a parse error. However...

<form method="POST" action="<?php print $PHP_SELF; ?>">
<input type="checkbox" value="1" name="a1">
<input type="checkbox" value="1" name="b1">
<input type="submit" name="Answer" value="Answer">
</form>
<?php
print $a1;
print $b1;
?>

Works without fail.

It suggests to me that there may be an issue with the naming of your
checkboxes.
--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
boclair
Guest
 
Posts: n/a
#5: Jul 17 '05

re: $_POST is empty (in MSIE?)


Attribute values of type ID and NAME must begin with a letter in the range
A-Z or a-z and may be followed by letters (A-Za-z), digits (0-9), hyphens
("-"), underscores ("_"), colons (":"), and periods ("."). These values are
case-sensitive

Louise

"Geoff Berrow" <blthecat@ckdog.co.uk> wrote in message
news:prsn30lrebshr0dolfpaifcldie72ff4d9@4ax.com...[color=blue]
> I noticed that Message-ID: <c1glqh$n7a$1@svr7.m-online.net> from Rudolf
> Horbas contained the following:
>[color=green]
> >I have a form like:
> >
> ><form method="POST" action="https://.../result.html?qid=70">
> > <input type="checkbox" value="1" name="1a">
> > <input type="checkbox" value="1" name="1b">
> > (...)
> > <input type="submit" name="Answer" value="Answer">
> ></form>[/color]
>
> Can't help with the intermittent thing but while I was checking this out
> I was lazy (I have register_globals on) and wrote this
>
> <form method="POST" action="<?php print $PHP_SELF; ?>">
> <input type="checkbox" value="1" name="1a">
> <input type="checkbox" value="1" name="1b">
> <input type="submit" name="Answer" value="Answer">
> </form>
> <?php
> print $1a;
> print $1b;
> ?>
>
> Doesn't work. Gives a parse error. However...
>
> <form method="POST" action="<?php print $PHP_SELF; ?>">
> <input type="checkbox" value="1" name="a1">
> <input type="checkbox" value="1" name="b1">
> <input type="submit" name="Answer" value="Answer">
> </form>
> <?php
> print $a1;
> print $b1;
> ?>
>
> Works without fail.
>
> It suggests to me that there may be an issue with the naming of your
> checkboxes.
> --
> Geoff Berrow (put thecat out to email)
> It's only Usenet, no one dies.
> My opinions, not the committee's, mine.
> Simple RFDs http://www.ckdog.co.uk/rfdmaker/[/color]


Geoff Berrow
Guest
 
Posts: n/a
#6: Jul 17 '05

re: $_POST is empty (in MSIE?)


I noticed that Message-ID:
<c1gtor$1hj9ue$1@ID-210679.news.uni-berlin.de> from boclair contained
the following:
[color=blue]
>Attribute values of type ID and NAME must begin with a letter in the range
>A-Z or a-z and may be followed by letters (A-Za-z), digits (0-9), hyphens
>("-"), underscores ("_"), colons (":"), and periods ("."). These values are
>case-sensitive[/color]

There ya go...

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Rudolf Horbas
Guest
 
Posts: n/a
#7: Jul 17 '05

re: $_POST is empty (in MSIE?)


OhmygodIshouldaknownthat...

Thanks Geoff & Louise!

(Obviously most browsers still handle these kind of values, but it's
MSIE that conforms to the standards ...)

Rudi
Rudolf Horbas
Guest
 
Posts: n/a
#8: Jul 17 '05

re: $_POST is empty (in MSIE?)


Geoff Berrow wrote:
[color=blue]
> (...)
> boclair wrote:[color=green]
>>Attribute values of type ID and NAME must begin with a letter in the range
>>A-Z or a-z and may be followed by letters (A-Za-z), digits (0-9), hyphens
>>("-"), underscores ("_"), colons (":"), and periods ("."). These values are
>>case-sensitive[/color]
>
>
> There ya go...[/color]

Darn, I was so glad when I read what I thought was the solution ...
But then noticed that I had just stripped the name attribute for better
reading ... My name attributes are really correct and are named like
"antw1a", etc ...

The whole setup is like:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<body>
<!-- <form method="POST" action="result.html?fid=67">
this is the receiving script, but we might aswell use
PHP_SELF:
-->
<form method="POST" action="<?=$_SERVER['PHP_SELF']?>">
Question 1<br />
answer1.a <input type="checkbox" value="1" name="antw1a"><br />
answer1.b <input type="checkbox" value="1" name="antw1b"><br />
Question 2:<br />
answer2.a <input type="checkbox" value="1" name="antw2a"><br />
answer2.b <input type="checkbox" value="1" name="antw2b"><br />
<input type="hidden" name="fid" value="67">
<input type="submit" name="Answer" value="Answer">
</form>
<pre>
<?php
print_r ( $_POST );
?>
</pre>
<?php

// This is what happens in the receiving script:
reset( $_POST );
$fields = "";
$values = "";

while ( list ( $key, $val ) = each( $_POST ) )
{
// get only answer checkboxes:
if ( preg_match ( "/^antw[0-9]+[a-z].*/", $key ) )
{
// build sql-string:
$fields .= "`$key`,\n";
$values .= "'$_POST[$key]',\n";
}
}

// other form data:
$fields .= "`fid`,\n";
$values .= "'$fid',\n";

$fields .= "`date`\n";
$values .= "'" . date ("Y-m-d H:i:s") . "'\n";


$sql = "INSERT INTO `tablename` ($fields) VALUES ($values)";

//$result = mysql_query($sql, $connect);
echo "<pre>$sql</pre>";
?>
</body>
</html>

In my .htaccess I have:
# not that I really need it, but to be sure ...
php_value register_globals 1

RewriteEngine on
RewriteRule ^(.*)\.html foodir/$1.php [nocase]

As already mentioned, in most cases everything is fine. I have had more
than 1.000 submits without problems, but every once in a while,
someone's $_POST is empty. What's more: This usually happens to the same
people. The last guy I had was on XP, MSIE 6.0, .NET installed, Cookies
on (I use $_SESSION). He never managed to submit one single form with
any data.

Could https be a problem, in a way that it sometimes "eats" up POST data?

Aw, while thinking that much aloud, Google brought up the solution on
"POST https problem":
http://www.phparch.com/discuss/index...372/0#msg_2372
and, linked from there:
http://support.microsoft.com/default.aspx?kbid=831167
<cite>
SYMPTOMS
Programs that use Wininet functions to post data (such as a user name or
a password) to a Web server retry the POST request with a blank header
if the Web server closes (or resets) the initial connection request.
</cite>

I guess that's it: a bug in MSIE.

Now I'll have to see if I can handle this on the server (MS gives some
hints: increase HTTP keep-alive timeout interval). Otherwise the users
will get a hint to update ...

*sigh*

Greetings & thanks for Your feedback,
Rudi
Stephen Poley
Guest
 
Posts: n/a
#9: Jul 17 '05

re: $_POST is empty (in MSIE?)


On Wed, 25 Feb 2004 00:16:37 +0100, Rudolf Horbas <rhorbas@gmx.net>
wrote:
[color=blue]
>G'day,
>
>has any of You ever experienced the problem that posted forms deliver an
>empty $_POST-array?[/color]

<snip>
[color=blue]
>and every once in a while I get empty results (1 out of 10, maybe). This
>only happens in MSIE 6.0, as far as I can see, but I'm not absolutely sure.
>Some users have the problem all the time, some never.[/color]

Not personally, but this sounds like a problem that I read about
somewhere within the last week or two. I think it was in
comp.lang.perl.misc. It's an IE error which crops up when certain
combinations of patches are applied. You might try Googling on the
archive for that group.

--
Stephen Poley
Geoff Berrow
Guest
 
Posts: n/a
#10: Jul 17 '05

re: $_POST is empty (in MSIE?)


I noticed that Message-ID: <c1i00s$1b6$1@svr7.m-online.net> from Rudolf
Horbas contained the following:
[color=blue]
>As already mentioned, in most cases everything is fine. I have had more
>than 1.000 submits without problems, but every once in a while,
>someone's $_POST is empty. What's more: This usually happens to the same
>people. The last guy I had was on XP, MSIE 6.0, .NET installed, Cookies
>on (I use $_SESSION). He never managed to submit one single form with
>any data.[/color]

Something to do with XP perhaps? Wouldn't surprise me

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Rudolf Horbas
Guest
 
Posts: n/a
#11: Jul 17 '05

re: $_POST is empty (in MSIE?)


Stephen Poley wrote:[color=blue]
> On Wed, 25 Feb 2004 00:16:37 +0100, Rudolf Horbas <rhorbas@gmx.net>
> wrote:
> (..)[color=green]
>>and every once in a while I get empty results (1 out of 10, maybe). This
>>only happens in MSIE 6.0, as far as I can see, but I'm not absolutely sure.
>>Some users have the problem all the time, some never.[/color]
>
>
> Not personally, but this sounds like a problem that I read about
> somewhere within the last week or two. I think it was in
> comp.lang.perl.misc. It's an IE error which crops up when certain
> combinations of patches are applied. You might try Googling on the
> archive for that group.[/color]

Thanks, the problem is clear now (thanks to Google).
See Message-ID: <c1i00s$1b6$1@svr7.m-online.net>

Rudi
Rudolf Horbas
Guest
 
Posts: n/a
#12: Jul 17 '05

re: $_POST is empty (in MSIE?)


Geoff Berrow wrote:
[color=blue]
> Something to do with XP perhaps? Wouldn't surprise me[/color]

Not quite. It's MSIE 6.0 with a certain security update, and the client
side solution is another MSIE patch ...
http://support.microsoft.com/default.aspx?kbid=831167

I suppose that the server-side solution that MS suggests ("Increase HTTP
keep-alive timeout interval") is not really a solution, because You only
decrease the probability that the error happens.

My forms are lengthy multiple-choice questionnaires for medical
education, and some users might dwell some reasonable time on them.

Damn, I mean, program server-side because we don't depend on any
clients, right?

XP is not so bad after all ... at least it's _a_lot_ better than 98 ...

Rudi
Rudolf Horbas
Guest
 
Posts: n/a
#13: Jul 17 '05

re: $_POST is empty (in MSIE?)


Geoff Berrow wrote:
[color=blue]
> Something to do with XP perhaps? Wouldn't surprise me[/color]


Not quite. It's MSIE 6.0 with a certain security update, and the client
side solution is another MSIE patch ...
http://support.microsoft.com/default.aspx?kbid=831167

I suppose that the server-side solution that MS suggests ("Increase HTTP
keep-alive timeout interval") is not really a solution, because You only
decrease the probability that the error happens.

My forms are lengthy multiple-choice questionnaires for medical
education, and some users might dwell some reasonable time on them.

Damn, I mean, program server-side because we don't depend on any
clients, right?

XP is not so bad after all ... at least it's _a_lot_ better than 98 ...

Rudi
Rudolf Horbas
Guest
 
Posts: n/a
#14: Jul 17 '05

re: $_POST is empty (in MSIE?)


Geoff Berrow wrote:
[color=blue]
> Something to do with XP perhaps? Wouldn't surprise me[/color]


Not quite. It's MSIE 6.0 with a certain security update, and the client
side solution is another MSIE patch ...
http://support.microsoft.com/default.aspx?kbid=831167

I suppose that the server-side solution that MS suggests ("Increase HTTP
keep-alive timeout interval") is not really a solution, because You only
decrease the probability that the error happens.

My forms are lengthy multiple-choice questionnaires for medical
education, and some users might dwell some reasonable time on them.

Damn, I mean, program server-side because we don't depend on any
clients, right?

XP is not so bad after all ... at least it's _a_lot_ better than 98 ...

Rudi
Closed Thread