6

The following form causes an empty $_POST variable on IE9.

<form id='login' action='login.php' method='POST' accept-charset='UTF-8'>
<input type='text' name="username" id='username'  />
<input type='password' name='password' id='password' />
<input type="text" name="store" />
<input type='submit' name='Submit' value='Submit' />
</form>

The form works perfectly on Firefox and Chrome. All variables appear in the $_POST variable with no issues.

On IE9, however, the form is submitted properly, but $_POST is the empty array. I.e., in login.php:

print_r($_POST);

prints the empty array. I'm trying to figure out what could be different about IE9 that's making it behave differently from Firefox and Chrome and I can't figure it out.

I found mention of some module under Apache that's causing people problems, but I'm running IIS7, not Apache, so that's not it. Someone on a Ruby forum mentioned setting a DisableNTLMPreAuth to 1 in the registry, but that hasn't fixed it either.

Any help is appreciated.

13
  • 1
    Have you tried outputting phpinfo()? It would be interesting to see if any of the request variables are populating. For instance, $_REQUEST May 21, 2012 at 14:47
  • 5
    open the developer-comsole on IE (pressing F12) and switch to the network-tab. now submit your form and take a look at the shown request: are the post-values mentioned there (wich means you problem is server-side) or are they missing (problem is client-side).
    – oezi
    May 21, 2012 at 14:48
  • 4
    what's the output of var_dump($_POST); ?
    – Alex
    May 21, 2012 at 14:56
  • 5
    Thanks for the ideas. Cheers especially for the IE developer console. I can see that a POST is sent for a split second (and I was quick enough that I could see the relevant input fields are being sent). A split second after the POST is sent, it loads the PHP page using a GET instead of a POST. I think we've narrowed down the problem to an http-equiv="refresh" which is going wrong on the target page. That's causing it to do a GET. Thanks everyone! May 21, 2012 at 14:57
  • 5
    You could/should answer your question for yourself. Then accept your answer, so this is shown as answered and the solution is better documented and not hidden in the comments.
    – Krista K
    Jun 17, 2012 at 20:09

4 Answers 4

1

accept-charset is not support in Internet Explorer. Remove it and see if that solves you're problem.

0

I think this is to do with a double hit - i.e. that IE is re-reloading the page somehow. Have you got some client side stuff (jQuery?) that re-reloads the page by accident as a bug? Try posting to a completely new page and writing <?PHP die ('<pre>'.print_r($_REQUEST,true).'</pre>');?> on the top line and seeing what happens.

-1

plz enter "name" attribute for form.

<form id='login'  name='login' action='login.php' method='POST' accept-charset='UTF-8'>
<input type='text' name="username" id='username'  />
<input type='password' name='password' id='password' />
<input type="text" name="store" />
<input type='submit' name='Submit' value='Submit' />
</form>
-1

The reason is you are not maintaining the session. In Firefox and Chrome are much smart and they maintain the session irrespective of the Development of the Code, which gives users a good things. But in IE6-9, IE Can't maintain session, developer has to check it and if the session is not maintained every page loaded is a new session and thus there is no post.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.