Viewing the username cookie : isset « Data Type « PHP






Viewing the username cookie

 
<?php
setcookie("username","michele");
echo 'Cookie created.';

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








Related examples in the same category

1.Checking PHP's global authentication variables
2.Checking Whether a Variable Is Set: isset( )
3.Using the isset() function to see whether an array element is defined for a given index.
4.bool isset ( mixed var [, mixed var [, ...]] ) returns true if its parameter has been set