Reputation: 575
I don't understand where is my mistake:
Page a.php
:
setcookie("user",$username,time()+300);
Page b.php
:
echo $_COOKIE['user'];
or echo $_COOKIE["user"];
The result is that echo
doesn't print nothing!
Thank you very much for the help!
Upvotes: 1
Views: 83
Reputation: 5399
Either $username
has no value or you have white-space before you are setting the cookie. Cookies must be sent with the header information before any HTML is sent at all so make sure the
Upvotes: 1