I use this command to set a cookie in my project
setcookie("userstate",$loginusername);
but it does not run I also use
echo setcookie("userstate",$loginusername);
but it dose not work too
I use netbeans and this command is recognized in it but it is not work what is the solution?
You set a cookie using setcookie("cookie_name", $value);
, so you've got that right. You access a cookie, using the superglobal variable $_COOKIE
. It's an associative array, and you can use it like this:
setcookie("userstate", $loginusername);
echo $_COOKIE["userstate"];