<?php
setCookie("CITY","Nowhere",0,'/');
?>

I see the cookie within the Firefox cookies window, but it's not in the cookies.txt where the browser stores all cookies. What am I missing?

Revised:
Is it that I still have to set the domain argument to say '.domain.com'

If I just use setCookie("CITY","Nowhere"), it shows the cookie domain as "localhost", and path as "/php/". But, when I looked into the localhost/php/ folder, I don't see the cookie file?

    try testing your cookies in internet exployer first... Firefox in a little finickyπŸ†’

      thtmal wrote:

      <?php
      setCookie("CITY","Nowhere",0,'/');
      ?>

      I see the cookie within the Firefox cookies window, but it's not in the cookies.txt where the browser stores all cookies. What am I missing?

      Revised:
      Is it that I still have to set the domain argument to say '.domain.com'

      If I just use setCookie("CITY","Nowhere"), it shows the cookie domain as "localhost", and path as "/php/". But, when I looked into the localhost/php/ folder, I don't see the cookie file?

      Even though the above will show that the cookie is set, but it did not set the data within Firefox's cookies.txt or create the cookie file with IE, it seemed that I HAD to set the expire argument and not just using 0.

      setCookie("CITY","Nowhere",time()+3600,'/','.domain.com');

        thtmal wrote:

        t seemed that I HAD to set the expire argument and not just using 0.

        Precisely; an expire time of "0" means that it's a per-session cookie. In otherwords, it is not stored on your hard drive but rather in the browser's allocated memory. Once you close the browser window, it releases it's memory allocation and thus the cookie is gone.

          bradgrafelman wrote:

          Precisely; an expire time of "0" means that it's a per-session cookie. In otherwords, it is not stored on your hard drive but rather in the browser's allocated memory. Once you close the browser window, it releases it's memory allocation and thus the cookie is gone.

          Thanks for that explanation, which makes this part all fall into place. No wonder why I could not find ANY cookies even though it showed the path when the expire was initially set to 0.

          πŸ†’

            Write a Reply...