dinosoup Posted March 26, 2007 Share Posted March 26, 2007 Hi. I'm just writing a site with PHP to learn more. This is the code to verify the login (just to test): if ( !strcasecmp($_POST['user_id'], 'wtf') ) //do log in Now the case of the input shouldn't matter and it works in both Firefox and Opera. But in IE I found that if I use left "shift" button to type in caps, then it won't work, but using "caps" and right "shift" works?? In Firefox and Opera, both "shift" and "caps" work. This is the link http://redrum.no-ip.info/speed/index.php you can try it out. I also tried this on my other desktop and laptop and same thing happens. I wrote a script to test the encoding the of input (http://redrum.no-ip.info/speed/detect.php). I just use the function mb_detect_encoding() to test the $_POST variable and I find that when I use the right shift button in IE and it doesn't work, it won't return an encoding. All other times when it works, it returns ASCII. I don't know if this has anything to do with it. Does anyone why? Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/44275-solved-strange-login-problem-with-ie/ Share on other sites More sharing options...
btherl Posted March 26, 2007 Share Posted March 26, 2007 I tried here with IE 6, and didn't see any difference. If I clicked the button, I would see ASCII, regardless of whether I used the left or right shift key. If I hit enter instead of clicking the button, I would see nothing. Quote Link to comment https://forums.phpfreaks.com/topic/44275-solved-strange-login-problem-with-ie/#findComment-215108 Share on other sites More sharing options...
dinosoup Posted March 26, 2007 Author Share Posted March 26, 2007 Thanks for testing it. You're right, I didn't even notice that. So the problem with IE seems to be pressing the enter key doesn't work? I tried the login page again and only clicking the button would work. I'm confused. Quote Link to comment https://forums.phpfreaks.com/topic/44275-solved-strange-login-problem-with-ie/#findComment-215118 Share on other sites More sharing options...
btherl Posted March 26, 2007 Share Posted March 26, 2007 Try a script that does var_dump($_POST), and you'll see what happens when enter is pressed. Because you never clicked any submit button, the browser doesn't have to set the submit button to "successful" and add it to the post data. You can also submit a form without a submit button using javascript. Quote Link to comment https://forums.phpfreaks.com/topic/44275-solved-strange-login-problem-with-ie/#findComment-215124 Share on other sites More sharing options...
dinosoup Posted March 26, 2007 Author Share Posted March 26, 2007 Ah thanks I got it. For the login code: <form action="<?php echo basename($_SERVER['PHP_SELF']); ?>?action=login" method="post"> <p> <input type="text" name="user_id" value="" /> <input type="submit" name="login" value="Login" /> </p> </form> I was using isset($_POST['login']) to detect when the form was submitted. Apparently this doesn't work in IE. I have to use isset($_POST['user_id']). But it works in Firefox and Opera. Which should be the correct behavior? Edit: Just found on google, apparently this is a bug with IE. http://weblogs.asp.net/jeff/archive/2005/07/26/420618.aspx "Just in case other people come to this page because they have a form that won't submit with the enter key: There is a retarded bug (I think with IE) where if there is only one text box and one button, the submit will NOT be fired when pressing the enter key. The work around is to add another input control somewhere - using another read-only text box of 0 width and 0 height worked for me." Quote Link to comment https://forums.phpfreaks.com/topic/44275-solved-strange-login-problem-with-ie/#findComment-215131 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.