ghurty Posted August 9, 2007 Share Posted August 9, 2007 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"; } Quote Link to comment https://forums.phpfreaks.com/topic/64039-script-to-place-cookie-works-in-firefox-but-not-in-internet-explorer/ Share on other sites More sharing options...
phpknight Posted August 9, 2007 Share Posted August 9, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/64039-script-to-place-cookie-works-in-firefox-but-not-in-internet-explorer/#findComment-319210 Share on other sites More sharing options...
ghurty Posted August 9, 2007 Author Share Posted August 9, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/64039-script-to-place-cookie-works-in-firefox-but-not-in-internet-explorer/#findComment-319535 Share on other sites More sharing options...
phpknight Posted August 10, 2007 Share Posted August 10, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/64039-script-to-place-cookie-works-in-firefox-but-not-in-internet-explorer/#findComment-319836 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.