Retrieving Cookie
Basis
If your cookie hasn’t expired yet, let’s retrieve it from the user’s PC using the aptly named $_COOKIE associative array. The name of your stored cookie is the key and will let you retrieve your stored cookie value!
Ex
<?php
if(isset($_COOKIE[‘lastVisit’]))
$visit = $_COOKIE[‘lastVisit’];
echo “Your last visit was – “. $visit;
?>
Outline
Here we have used isset function to be sure that our “lastVisit” cookie still exists on the user’s PC, if it does, then the user’s last visit is displayed.
Categories: PHP
Comments (0)
Trackbacks (0)
Leave a comment
Trackback