<?php
// Need to set any cookie information before outputting any HTML data
$bgcolor = $_REQUEST['bgcolor'];
setcookie("colorpref", $bgcolor, time() + 60*60*24*7, "/");
print <<<END_PAGE
<html>
<head><title>Hello!</title></head>
<body bgcolor='$bgcolor'>
<p>Your background color preference has been set. <a
href='cookie1.php'>Click here</a> to go back to the main page</p>
</body>
</html>
END_PAGE;
?>