Learning PHP and MySQL

Example 13-2 Viewing the username cookie

<?php
if  (!isset($_COOKIE['username']))
{
echo  ("Opps,  the  cookie  isn't  set!");
}
else
{
echo  ("The  stored  username  is  ".  $_COOKIE['username']  .  ".");
}
?>

This code displays with the stored username:

The stored username is michele.

Posted by on 09/25 at 11:24 AM

Next entry: Example 13-3 Destroying a cookie by expiring it in the recent past

Previous entry: Example 13-1 Creating a cookie

<< Back to main