Hello! I have noticed that many of my scripts intermittently break because PHP is not setting cookies. It is only for the PHP scripts that I use for the website I am working on where this happens.
Here is a test script where I test for cookies:
Each time I run this script, I get a "Notice: Undefined index: foo on line 3" error. What could I be doing wrong?
Here is a test script where I test for cookies:
Code:
<?php
setcookie("foo","bar",time() + 86400);
echo $_COOKIE["foo"];
?>
Each time I run this script, I get a "Notice: Undefined index: foo on line 3" error. What could I be doing wrong?