Recently started investigating how cookies worked for a upcoming project. Here is some of my research.
You can create a cookie using the following code:
//Set a value for the cookie
$value = 'I am a cookie!';
//Call setcookie php function
setcookie ("TestCookie", $value);
//print results to confirm
print "<p>The cookie says: " . $_COOKIE["TestCookie"] . "</p>";
The cookie says:
You can print a list of cookies using the following code:
foreach ($_COOKIE as $key => $value) {
print "<strong>Key:</strong> " . $_COOKIE[$key] . " <strong>Value:</strong> " . $value . "<br>";
}