Forum Moderators: coopster
Is there anyone that can explain simply how to set and read a cookie with PHP? Thanks
$_COOKIE superglobal array [ca2.php.net]
if we look at the setcookie function [ca2.php.net]
Once the cookies have been set, they can be accessed on the next page load with the $_COOKIE or $HTTP_COOKIE_VARS arrays.
the example is
$value = 'something from somewhere';
setcookie ("TestCookie", $value);
then
echo $_COOKIE["TestCookie"];
the output would be
something from somewhere
you could also put the value into a var like so
$myvar = $_COOKIE["TestCookie"];
that make sense?