Cookie difference IE/FF

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Hello all,
I'm trying to do something very simple: delete (or empty) a cookie.
The following code (which I found in the PHP doc) works fine in IE6 but not  
in Firefox:
setcookie ("Cart", "", time() - 3600);
Any hint on what's wrong ? Yes, I issue this command before sending in any  
Guillaume Dargaud

Re: Cookie difference IE/FF

If you are trying to build a shopping cart i would highly reccommend
that you look into using sessions instead of a normal cookie.




Re: Cookie difference IE/FF

Quoted text here. Click to load it
Hmmm, yup. Given away by my variable name !
I want to do something extremely simple, so I thought it would be a good way  
to do it. What's wrong with this approach ?

Quoted text here. Click to load it
OK, thanks, I'll look it up.
Guillaume Dargaud
  "If brute force doesn't solve your problems, then you aren't using  

Re: Cookie difference IE/FF

Quoted text here. Click to load it

So you're asking the browser to create a cookie which should have
expired an hour ago. When one already exists. While this is documented
in the set_cookie() function page as way of achieving the desired
result, it strikes me as an ugly hack. I think a better way to solve
this would be to set a cookie which expires in the future with a value
indicating that it no longer references a valid server-side state.

If you can find something in the HTTP RFCs which says this should
work, then by all means raise it as a bug with the FireFox developers.


Re: Cookie difference IE/FF

Quoted text here. Click to load it

Not everyone has cookies enabled in their browser. Cookies are
problematic in this way and should only really be used for non-vital

Sessions on the other hand are far more reliable.

Re: Cookie difference IE/FF

Kimmo Laine wrote:
Quoted text here. Click to load it

Unless next_page.php generates PHP, the script with this include will
only get HTML.

Quoted text here. Click to load it


    if (isset($_GET['foo'])) {
      echo '<?php echo $_GET[\'foo\']; ?>';
    } else {
      echo '<?php echo \'Not available\'; ?>';

File not found: (R)esume, (R)etry, (R)erun, (R)eturn, (R)eboot

Re: Cookie difference IE/FF

I found what the problem was: I had forgotten the path info '/' in one of  
the setcookie calls and it was creating a great deal of confusion.

As to using sessions, I only need something very simple, and it doesn't need  
to be secure (famous last words !) as security is handled by another system.  
A javascript workaround handles the cookieless fine. As for the  
scriptless... I even have a workaround for that.

But I'll keep it in mind. Thanks for the previous answers.
Guillaume Dargaud
'Come out and say that, Tyson !'  

Site Timeline