Newbie Question: Using Cookies...
| From: | Anthony Ritter | Date: | Thu, 03 Jan 2002 18:55:25 +0000 |
| Subject: | Newbie Question: Using Cookies... | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-11283@lists.php.net to get a copy of this message | ||
I'm new to PHP and am trying this script to see if a cookie has been set on
my server. It has a fifteen minute expiration time.
I'm using MS Windows 98 / Apache
Before I load the browser, I have designated to have the prompt box ask
whether to accept cookies or not to see if, in fact, the cookie will be
set.
I load the page into the browser and it says:
Cookie has been set
However...
1. I didn't get a prompt box
and
2. when I go to check if the cookie has been set in:
C:\Windows\Cookies\
there is no text file.
If anybody has a clue as to what I'm doing wrong please assist.
Many thanks.
Tony Ritter
The script follows...
.....................................................................
<?
$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>
</BODY>
</HTML>