Question

I tried, to no avail! My problem is php's setcookie() fails in IE6. It's fully functioning (albeit buggy) for Firefox 3 and IE7/8. The following is the code. IE6 displays fail. Simple question: why?

<?
    header('P3P: CP="DEV PSAi NAV STP DEM OTRo NOI IDC 
                     DSP COR CURa ADMa OUR IND PHY ONL COM STA"'); 

    setcookie('hello', 'poopoo');

    echo $_COOKIE['hello'];
?>

I suspected P3P (link), or maybe some bug with the timezone-- IE6 javascript not converting time to the same standard that php uses (so that all server-issued cookies are automatically expired).

Here's what I've done: For the p3p issue, I inserted the above header tag. I've also created a policy file, and a policy reference, and run the my site through w3c's p3p checker with no errors.

For the timezone issues, I reset the time zone in browscap.ini. I also tweaked my clock forward, and backward by 24 hours.

If you can give me any new things to try, it would be very much appreciated. All I need is a Hello World cookie setter for IE6.

I appreciate it.

*Update: I caught wind that the standalone IE6 has issues that match this. Can anyone with IE6 do a quick check that you can add items to the cart on my alpha?

Was it helpful?

Solution

Final Update: Bug caused by standalone ie6 run on vista. Dl'ed official msft virtual pc and virtual hd and the site worked perfect.

OTHER TIPS

What are the security settings for IE?

Could it be that the security settings on it don't allow you to write cookies for it?

The $_COOKIE array is filled during your script initialisation. It is not changed by setcookie : the value will have changed at next page loading.

See the php manual for the setcookie function :

Once the cookies have been set, they can be accessed on the next page load with the $_COOKIE or $HTTP_COOKIE_VARS arrays.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top