Re: Reading the value in a cookie
| From: | Steven Walker | Date: | Wed, 20 Feb 2002 18:38:16 +0000 |
| Subject: | Re: Reading the value in a cookie | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-85568@lists.php.net to get a copy of this message | ||
Brandon,
There are a few things about cookies that are not completely. I may be wrong about this, but this is what I've found:
• When a cookie is set, it must be passed before any other headers or tags. But the cookie is not actually available to the page it was set on. If the user reloads the page, or goes to another link, the cookie can then be read.
• When you put setcookie() in a PHP file, the cookie will be created every time the page is loaded. This will overwrite any previous cookie info stored. To overcome this, you can use conditional statements that test for the cookie. Just be sure that any code before setcookie does not create output (ie echo).
Steven J. Walker
Walker Effects
www.walkereffects.com
steve@walkereffects.com
On Wednesday, February 20, 2002, at 10:04 AM, Brandon Orther wrote:
Hello, I know how to set a cookie. How do I read the value of that cookie the next time that person returns to my website? -------------------------------------------- Brandon Orther WebIntellects Design/Development Manager brandon@webintellects.com 800-994-6364 www.webintellects.com --------------------------------------------