/    Sign up×
Community /Pin to ProfileBookmark

Help! My php code works in Firefox and Safari, but not in IE!

Hey guys, I am having a serious issue here that is really pulling the hair from my skull. I have a very simple login page, that just requires a password to submit the form, and the code works conditionally.

1) Always, in Firefox.
2) Always, in Safari.
3) In Internet Explorer, if you PASTE the text into the field, the form will work.

Typing the text into the form does not work. Weird, I know.

Guys, I am TOTALLY stumped here, and this could cost me my reputation and ego with a client. I am a n00b rookie, I will own that.

Please help!

Btw:

The HTML Form:

[code=html]
Admin Login:
<form action=”<?php echo $_SERVER[‘PHP_SELF’]; ?>” method=”post”>
<fieldset style=”border:none;width:200px;margin:auto;”>
<input type=”password” name=”password” size=”15″ />
<input type=”submit” name=”submit” id=”submit” value=”Sign In” />
</fieldset>
</form>
[/code]

And the PHP Code:

[code=php]
<?php

require_once(‘includes/config.php’);

if($_POST[‘submit’]) {

//print_r($_POST);

if(strcmp($_POST[‘password’],’keyvox4u’) == 0) {
//print ‘Success!’;
$_SESSION[‘login’] = true;
header(“Location:http://www.keyvox.com/storefront.php”);
} else {
//print ‘Fail!’;
$_SESSION[‘login’] = false;
unset($_POST[‘submit’]);
header(“Location:http://www.keyvox.com/”);
}
}

require_once(‘includes/head.inc.php’);

?>

[/code]

Please help me!

Pierce

to post a comment
PHP

4 Comments(s)

Copy linkTweet thisAlerts:
@Four_StaplesJun 11.2009 — Please link us your page, PHP cannot work differently from browser to browser, it must be a problem with your HTML, the way it's being sent, or the URL to which it's being sent.
Copy linkTweet thisAlerts:
@PierceMooreauthorJun 11.2009 — Thank you for your response! I didn't know anyone had replied to this thread yet :/

The page is:

Http://www.keyvox.com

Try password 'keyvox4u' and it should take you to a new page.

I sincerely appreciate all your help!!! I am truly baffled here!
Copy linkTweet thisAlerts:
@cubeevolutionJun 11.2009 — The problem is that you are checking for $_POST['submit'] and in internet explorer this condition will only be satisfied if you actually press the submit button.

You can prove this by typing your password and pressing the submit button instead of the enter key.

Then it all works as expected.

I suggest that you have a hidden field and then check to see if that has been posted in your php code. This should cure the problem.
Copy linkTweet thisAlerts:
@PierceMooreauthorJun 12.2009 — cubeevolution: The problem is that you are checking for $_POST['submit'] and in internet explorer this condition will only be satisfied if you actually press the submit button.

You can prove this by typing your password and pressing the submit button instead of the enter key.

Then it all works as expected.

I suggest that you have a hidden field and then check to see if that has been posted in your php code. This should cure the problem.[/QUOTE]


Thank you so much! I simply renamed the password field on the form, and now it works every single time!!

You are quite the lifesaver :-D

Pierce
×

Success!

Help @PierceMoore spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...