Re: Newbie Question: Using Cookies...
| From: | Steve Yates | Date: | Fri, 04 Jan 2002 06:56:55 +0000 |
| Subject: | Re: Newbie Question: Using Cookies... | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-11291@lists.php.net to get a copy of this message | ||
"Anthony Ritter" <tony@gonefishingguideservice.com> wrote in message
news:20020103174851.99784.qmail@pb1.pair.com...
> I load the page into the browser and it says:
> Cookie has been set
Unless I am missing something you will ALWAYS get this since this is
output as static body text?
> 1. I didn't get a prompt box
For what?
> <?
> $cookie_name = "test_cookie";
> $cookie_value = "test string!";
> $cookie_expire= time() + 900;
> setcookie($cookie_name, $cookie_value, $cookie_expire, "/", 0);
> ?>
> <HTML>
> <HEAD>
> <TITLE>Set Test Cookie</TITLE>
> </HEAD>
> <BODY>
> <h1>Cookie has been set</h1>
<?
(...)
setcookie ($cookie_name, $cookie_value, $cookie_expire, '/,
'localhost');
}
?>
The last part is your domain name, so "0" is probably not matching your
cookie to anything? Unless you're trying to make that the "secure"
parameter, in which case you skipped one (and besides you can simply
leave it off).
Then later:
<?
if (isset($cookie_value)) {echo "cookie=$cookie_value";} else {echo "no
cookie here";}
?>
- Steve Yates
- SRT Enterprises
- Change is inevitable, except from a vending machine.
/ Taglines by Taglinator - www.srtware.com /