Jump to content

php problem with IE not FF or Chrome


s4vi0r

Recommended Posts

Hey everyone,

 

I haven't been working with php long and that my be the root of the problem here but your help is very appreciated. Here is the problem:

 

I have created a login system for a website everything seems to be working great in Chrome and FF. However IE8 is giving some problems. It acts as if my $username and $password variables don't get set. However, I have tried using echo and they print out just fine. I have tried rearranging my code and checking  the variables with inset() ...nothing I try seems to work. Maybe I'm doing something wrong you guys can help with. Thanks. (Code below)

 

 

<?php
session_start();
// Connect to database code here (left out for obvious reasons)
******
******



//get user name and password before we try and connect
$username = $_POST['username'];
$password = $_POST['password'];


//if username and password suck go back to login screen otherwise check against database.
if(!$username && !$password)
{

header( 'refresh: 2; url=login.html' );
die("username and password could not be verified");

}
else
{
    ////here is where i would check database =p
}
....... 

Link to comment
Share on other sites

Figured it out.

 

Later in the code if information checked out I directed the user to another page using header() function. It looked like this:

 

$products = $username."/userProducts.html"; 
         
header( "refresh: 3; '$products'" );  

 

 

It should have looked like this:

 

 

$products = $username."/userProducts.html"; 
         
header( "refresh: 3; url='$products'" );  

 

Forgot the "url=" So what ended up happening is for some reason it refreshed the page it was on and didn't resubmit the form data that caused the problem. Funny that it only happened in IE, really stressed over this one. Probably should have used Location: here anyhow, oh well.

 

Figured this out by submitting the values through the url like:

 

URL?username=blah&password=blah

 

this caused the page to refresh over and over..and I was like wt heck, so I was able to figure out what was going on. Problem solved. Thanks for the help.

Link to comment
Share on other sites

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.