Cookies - either not saving or not reading correctly
Posted: Wed Jun 30, 2004 1:45 am
Ok, having trouble now with cookies. Here's what I've got:
cookietest1.php
cookietest2.php
I was having trouble before this, and narrowed it down to the cookies, so I created these two files to try to figure out why it wasn't working. But, I'm stumped! I checked IE's privacy settings, even changed them to the lowest possible, and still no luck.
Basically what I've done is created cookietest1.php to set the cookie, then it has a link to cookietest2.php which reads the cookie. The output from cookietest2.php is just blank - as if the cookie had never been set. No errors or anything.
Is there something here I'm doing wrong, or is just my unlucky day?
Thanks
- Tim
cookietest1.php
Code: Select all
<?php
setcookie("testcookie", "testvalue");
?>
<a href="cookietest2.php">click</a>Code: Select all
<?php
print ($_COOKIE["testcookie"]);
?>Basically what I've done is created cookietest1.php to set the cookie, then it has a link to cookietest2.php which reads the cookie. The output from cookietest2.php is just blank - as if the cookie had never been set. No errors or anything.
Is there something here I'm doing wrong, or is just my unlucky day?
Thanks
- Tim