This example will not have a form specified, you can do that.
<?php
if (isset($submit)) {
if (empty($username) || empty($password)) {
header("Location: register.php?back=1");
} else {
setcookie('registered',1,time()+(3600),'/','',0);
header("Location: register.php");
}
} else
if (isset($delete)) {
setcookie('registered','',time()-(3600),'/','',0);
header("Location: register.php");
} else {
?>
<html>
<body>
<?php
if (!$HTTP_COOKIE_VARS['registered']) {
if (isset($back) && $back == 1) { echo "Username and Password are required\n"; }
?>
FORM GOES HERE
<?php
} else {
echo "You have already registered<br><br><a href=\"register.php?delete=1\">Erase Cookie</a>\n";
}
?>
</body>
</html>
<?php
}
?>