Jump to content

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/44275-solved-strange-login-problem-with-ie/
Share on other sites

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.

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."

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.