I am not sure what the protocal is in posting code so I do aplogize if this is done in error.
This is what I have done over the past 4 days. I know it is close but I can't get it working.
<?php
// set cookie if not already set
if (!isset($id)) {
srand((double)microtime()*1000000);
$randval = rand();
setcookie("id",$randval,time()+14400,"/",".contesthound.com",0);
}
?>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script>
//javascript to make sure that the email field is filled in properly.
</script>
</head>
<body>
mysql_connect ("hostname", "username", "password");
mysql_select_db("hounddb")
or die ("Unable to select database.");
$ip = $REMOTE_ADDR;
$id = $HTTP_COOKIE_VARS["id"]
$sql = "SELECT * FROM contest_entries WHERE randval='$id'";
$id_result = mysql_query($sql);
$num = mysql_numrows($id_result);
if ($num != "0") {
echo "<P>You have already entered today. Please come back again tomorrow!</p>";
exit;
} else {
if ($submit) {
// process form
$sql = "INSERT INTO contest_entries (email,ip,date,randval) VALUES ('$email','$ip',now(),$randval)";
$result = mysql_query($sql);
echo "<span class=A13><b>Thank you! Information entered.\n</b>";
} else{
// display form
?> <form name="formname" method="post" action="<?php echo $PHP_SELF?>" onSubmit="return valid()">
Enter your E-mail address:<br>
<input type="Text" name="email">
<br>
<input type="Submit" name="submit" value="Enter Contest">
<?php
} // end if
?> </form>
</body>