Jump to content

Script to place cookie works in firefox but not in Internet Explorer


Recommended Posts

Hello,

 

I have been using the following script to find out what location the user has last chosen from a drop down list.

I testing it in firefox, and everything was working great.

However, when i tried to access the page using Internet Explorer, it would not save the cookie. When every I would go back to the page it would revert to the default location (new york).

I am using IE 7 with vista, I tried it with the privacy setting at medium and at low. It didnt work either which way.

 

Thanks

 

if(isset($_GET['activelocation'])){
$activelocation = $_GET['activelocation'];
setcookie('location', $activelocation, time()+60*60*24*30);
} elseif(isset($_COOKIE['location'])){
$activelocation = $_COOKIE['location']; //if the cookie is set, get the value
} else{
setcookie('location', 'New York, NY', time()+60*60*24*30);
$activelocation = "New York, NY";
}

Have you checked for any white space, etc?  Put the error reporting way up and display it on the screen.  You might be sending headers early.

 

Can you please explain a little clearer, I am pretty new at this, and the only way I got the initial script written properly was with some help from here.

 

Thank You

Put the very first line in the script to

 

error_reporting("E_ALL");

 

Then, see what kind of output you get in both browsers.  Do you get any warnings on the screen?  This is assuming you have display_errors set to 1 in your php.ini file.  It is that way by default.  This is not good for production but good for debugging.

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.