getcookie.php

<!-- Print value of cookie named 'sitecookie' if it is set.
     If not set, print "No cookie!"  Even though we control this cookie,
     we escape it for printing since that is a good habit to get into.
-->
<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Get cookie</title>
    <meta charset="utf-8">
  </head>
  <body>
<?php if( isset($_COOKIE['sitecookie']) ): ?>
    <h1>Cookie is <?php print htmlspecialchars($_COOKIE['sitecookie']); ?>  </h1>
<?php else: ?>
    <h1>No cookie!</h1>
<?php endif; ?>
  </body>
</html>