setcookie("name", "value");
...
$variable = $_COOKIE["name"]; # retrieve value of cookie later
setcookie("username", "martay"); setcookie("age", 19); ... if (isset($_COOKIE["username"])) { $username = $_COOKIE["username"]; print("Welcome back, $username.\n"); }
$_COOKIES
associative arrayisset
function to see whether a given cookie name exists
Use a cookie (slides) to count the number of times the user has viewed longcat.php
.
Display this count to the user on the page, e.g. "You have visited 7 time(s)."
(sample solution)
For added challenge:
middle.jpg
once for each page view.