cookie.php
<?
if(!isset($flag))
{
         header("Location:cookie.php?flag=1");
setcookie("firstcookie","first set cookie");
exit;
}
?>
<html>
<body>
<?
echo "Cookie: ".$_COOKIE['firstcookie'];
?>
</body>
</html>