Hey. I created a form that submits to a MySQL database. Most of the code below is the form and it worked great until I added some cookies. Now nothing works. All I'm looking for is some feedback on whether I'm using the cookies correctly. I've added the code below, which is pretty simple, and I would appreciate it if someone would give me some feedback. Thank you very much.
<?php
if( $contact or $church or $title )
{
setcookie( "form_contact", $contact, time()+15552000 );
setcookie( "form_phone", $phone, time()+15552000 );
setcookie( "form_email", $email, time()+15552000 );
setcookie( "form_church", $church, time()+15552000 );
setcookie( "form_location", $location, time()+15552000 );
header("Location:thanks.php" );
}
?>
<html>
<head>
<title>Events - submission</title>
</head>
<body bgcolor="191970">
<center><b><font size="5" face="Arial, Helvetica, sans-serif" color="c0c0c0">Events<font size="3"> - submission</font></font></b></center>
<b><font size="5" face="Arial, Helvetica, sans-serif" color="c0c0c0">
<form action="<?php echo($PHP_SELF); ?>" method="post">
<table align="center" width="566" bordercolor="#FF0000" border="0">
<tr valign="baseline">
<th align="right" height="20" width="221" nowrap>
<div align="right"><b><font size="3" face="Arial, Helvetica, sans-serif" color="c0c0c0">
Contact Name:</font></b> </div>
</th>
<td align="left" height="20" colspan="2">
<div align="left">
<input type="text" name="contact" size="30" maxlength="30" value="" >
</div>
</td>
</tr>
<tr valign="baseline">
<th align="right" height="22" width="221" nowrap>
<div align="right"><b><font size="3" face="Arial, Helvetica, sans-serif" color="c0c0c0">
Phone:</font></b> </div>
</th>
<td height="22" colspan="2">
<div align="left">
<input type="text" name="phone" size="30" maxlength="30">
</div>
</td>
</tr>
<tr valign="baseline">
<th align="right" width="221" nowrap>
<div align="right"><b><font size="3" face="Arial, Helvetica, sans-serif" color="c0c0c0">
Email:</font></b> </div>
</th>
<td colspan="2">
<div align="left">
<input type="text" name="email" size="30" maxlength="30" >
</div>
</td>
</tr>
<tr valign="baseline">
<th align="right" width="221" nowrap>
<div align="right"><b><font size="3" face="Arial, Helvetica, sans-serif" color="c0c0c0">
Church or Organization:</font></b> </div>
</th>
<td colspan="2">
<div align="left">
<input type="text" name="church" size="30" maxlength="30" >
</div>
</td>
</tr>
<tr valign="baseline">
<th align="right" height="5" width="221" nowrap> </th>
<td height="5" colspan="2"> </td>
</tr>
<tr valign="baseline">
<th align="right" height="20" width="221" nowrap>
<div align="right"><b><font size="3" face="Arial, Helvetica, sans-serif" color="c0c0c0">
Event Type:</font></b> </div>
</th>
<td height="20" colspan="2" nowrap>
<div align="left">
<input type="radio" name="type" value="Social" checked class="checkbox" >
<b><font size="3" face="Arial, Helvetica, sans-serif" color="c0c0c0">Social</font></b>
<input type="radio" name="type" value="Outreach" class="checkbox" >
<b><font size="3" face="Arial, Helvetica, sans-serif" color="c0c0c0">Outreach</font></b>
<input type="radio" name="type" value="Ministry" class="checkbox" >
<b><font size="3" face="Arial, Helvetica, sans-serif" color="c0c0c0">Ministry</font></b>
<input type="radio" name="type" value="Other" class="checkbox" >
<b><font size="3" face="Arial, Helvetica, sans-serif" color="c0c0c0">Other</font></b>
</div>
</td>
</tr>
<tr valign="baseline">
<th align="right" height="20" width="221" nowrap>
<div align="right"><b><font size="3" face="Arial, Helvetica, sans-serif" color="c0c0c0">
Event Title:</font></b> </div>
</th>
<td align="left" height="20" colspan="2">
<div align="left">
<input type="text" name="title" size="30" maxlength="30" >
</div>
</td>
</tr>
<tr valign="baseline">
<th align="right" width="221" nowrap>
<div align="right"><b><font size="3" face="Arial, Helvetica, sans-serif" color="c0c0c0">
Date of Event:</font></b> </div>
</th>
<td colspan="2">
<div align="left">
<input type="text" name="event_date" size="30" maxlength="30" >
</div>
</td>
</tr>
<tr valign="baseline">
<th align="right" width="221" height="19" nowrap>
<div align="right"><b><font size="3" face="Arial, Helvetica, sans-serif" color="c0c0c0">
Time: </font></b></div>
</th>
<td colspan="2" height="19">
<div align="left">
<input type="text" name="time" size="30" maxlength="30" >
</div>
</td>
</tr>
<tr valign="baseline">
<th align="right" width="221" nowrap><font face="Arial, Helvetica, sans-serif" size="3" color="c0c0c0"><b>Who's
Invited:</b></font></th>
<td colspan="2">
<input type="text" name="invited" size="30" maxlength="30" value="Young Adults">
</td>
</tr>
<tr valign="baseline">
<th align="right" width="221" nowrap>
<div align="right"><b><font size="3" face="Arial, Helvetica, sans-serif" color="c0c0c0">
Cost:</font></b> </div>
</th>
<td colspan="2">
<div align="left">
<input type="text" name="cost" size="30" maxlength="30" value="Free" >
</div>
</td>
</tr>
<tr valign="baseline">
<th align="right" width="221" height="19" nowrap>
<div align="right"><font size="3" face="Arial, Helvetica, sans-serif" color="c0c0c0">Event
Location: </font></div>
</th>
<td width="160" height="19">
<div align="left">
<input type="text" name="location" size="30" maxlength="30">
</div>
</td>
<td width="186" nowrap height="19"> <font face="Arial, Helvetica, sans-serif" size="3" color="c0c0c0"><b>Location
on map:</b></font> <font face="Arial, Helvetica, sans-serif" size="3" color="#FFFFFF">
<select name="map">
<option selected>0</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option>7</option>
</select>
</font> </td>
</tr>
<tr>
<th align="right" height="209" width="221">
<div align="left"><font face="Arial, Helvetica, sans-serif" size="2" color="#FFFFFF">This
is a map of Cincinnati marked in zones. This helps the viewers to determine
the location of the event.</font></div>
</th>
<td height="209" colspan="2">
<div align="left"><img src="images/form-map.png" width="179" height="200" align="middle"></div>
</td>
</tr>
<tr valign="baseline">
<th align="right" height="19" width="221" nowrap>
<div align="right"><font size="3" face="Arial, Helvetica, sans-serif" color="c0c0c0">
Event Street Address: </font></div>
</th>
<td align="left" height="19" colspan="2">
<div align="left">
<input type="text" name="address" size="30" maxlength="30" >
</div>
</td>
</tr>
<tr valign="baseline">
<th align="right" height="22" width="221" valign="top" nowrap>
<div align="right"><b><font size="3" face="Arial, Helvetica, sans-serif" color="c0c0c0">
Event Details:</font></b> </div>
</th>
<td align="left" height="22" colspan="2">
<div align="left">
<textarea name="details" cols="50" wrap="VIRTUAL" rows="6"></textarea>
</div>
</td>
</tr>
<tr valign="baseline">
<th align="right" height="21" width="221">
<div align="right">
<input type="reset" name="Reset" value="Reset">
</div>
</th>
<td align="left" height="21" colspan="2">
<div align="left">
<input type="submit" value="Submit Event">
</div>
</td>
</tr>
</table>
</form>
<?php
if ($contact and $church and $title)
{
$conn=@mysql_connect("localhost","root","")
or die("Err:Conn");
$rs=@mysql_select_db("events", $conn)
or die("Err:Conn");
$sql="insert into submitted (contact,phone,email,church,type,title,event_date,time,cost,map,location,address,invited,details)
values ( \"$contact\", \"$phone\", \"$email\", \"$church\", \"$type\", \"$title\", \"$event_date\", \"$time\", \"$cost\", $map, \"$location\", \"$address\", \"$invited\", \"$details\" )";
$rs=mysql_query($sql,$conn);
}
?>
</font></b>
<div align="center"><left><font size="3" face="Arial, Helvetica, sans-serif" color="c0c0c0">Note:
Please fill in all requested information to ensure the event is posted.</font></left>
</div>
</body>
</html>