I am trying to access a cookie that I just set on another page in the same domain, but it does not work. When I do echo $_COOKIE , the array is empty on the new page, but contains a cookie on the create page.
Here is the code in /PROC/LOGIN.PROC.PHP
//Set the cookie for 1 year. setcookie("username", $username, time()+365*24*60*60); setcookie("password", $password, time()+365*24*60*60);
Here is the code in /INC/HEADER.INC.PHP
if (isset($_COOKIE['username']) && isset($_COOKIE['password'])) { include("pages/user.header.pages.php");
But when I try to display a cookie or display only the array in header.inc.php, the array is empty.
source share