简体   繁体   中英

PHP $_POST is empty on IE9 and IIS7

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. Ie, 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.

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

I think this is to do with a double hit - ie 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.

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>

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM