Here is the form page
<form action="/fishingreports/report.php" method="post" onSubmit="return _post_checkpostform(this)">
<input type="hidden" name="fldparent" value="0">
<table class="body">
<tr>
<td width="121">Name:</td>
<td width="264">
<input type="text" class="inputbox" name="poster" />
</td>
</tr>
<tr>
<td width="121">Email Address:</td>
<td width="264">
<input name="email" type="text" class="inputbox" id="email" />
</td>
</tr>
<tr>
<td width="121">Message Title:</td>
<td width="264">
<input type="text" class="inputbox" name="subject" />
</td>
</tr>
<tr>
<td valign=top width="121"><p> </p>
<p> </p>
<p>Message:</p>
</td>
<td width="264">
<textarea wrap="virtual" class="inputbox" name="report" cols=40 rows=10></textarea>
</td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="Submit2" value="Submit" />
<input type="reset" name="Submit3" value="Reset" /> </td>
</tr>
</table>
<p>
</p>
</form>
Here is the script page that sends the mail and adds it to the db
$Host = "localhost";
$User = "username";
$Password = "password";
$DBName = "firstcrack";
$TableName = "tblreports";
$email_variable = "info@firstcrackcharters.com";
$email_variable_2 = "pinkboat@mindspring.com";
$myname = "First Crack Charters Fishing Reports";
$from_email = "fishingreports@firstcrackcharters.com";
$report_txt = preg_replace("/(\015\012)|(\015)|(\012)/"," <br />", $report);
$report_txt_output = stripslashes($report_txt);
$subject_txt = preg_replace("/(\015\012)|(\015)|(\012)/"," <br />", $subject);
$subject_txt_output = stripslashes($subject_txt);
$Link = mysql_connect ($Host, $User, $Password) or die ("The database connection could not be established!");
$query = "SELECT MAX(fldthread) as threads from tblreports";
$Result = mysql_db_query ($DBName, $query, $Link);
if (($email == $email_variable || $email == $email_variable_2)) {
$email_query = "Select * from tblemail";
$email_result = mysql_db_query ($DBName, $email_query, $Link);
while ($email_row = mysql_fetch_array($email_result)) {
$to = $email_row[email];
$message = "
<html>
<body>
<p><br><b>$subject_txt_output</b><br><br>$report_txt_output<br><br><br><br><br>
<font size=2>You are receiving this Fishing Report from firstcrackcharters.com because you subscribed to the First Crack Charters email list.<br>
If you wish to be removed from the email list, please click <a href=http://www.firstcrackcharters.com/unsubscribe.php?email=$email_row[email]>here</a>.</p>
<p>Visit <a href=http://www.firstcrackcharters.com/fishingreports>[url]www.firstcrackcharters.com[/url]</a> to check out all of the reports!</p></font>
</body>
</html>";
mail($to, $subject_txt_output, $message, "MIME-Version: 1.0\r\n"
."Content-type: text/html; charset=iso-8859-1\r\n"
."From: ".$myname." <".$from_email.">\r\n");
}
}
while ($Row = mysql_fetch_array($Result)) {
$x = 1;
$y = $x + $Row[threads];
}
$query = "INSERT INTO $TableName (id,fldparent,fldthread,fldname,fldemail,fldtitle,fldbody,flddate,fldip)
values ('0','$fldparent','$y','$poster','$email','$subject','$report','$thedate','$REMOTE_ADDR')";
if (mysql_db_query ($DBName, $query, $Link)) {
print"<center>";
print"<p>Your message has been posted!</p>";
print"<p><a href=/fishingreports/index.php><img src=/images/arrowleft.gif border=0><div class=boxbody>Back to main board</div></a></p>";
} else {
print"<p>We could not process you information at this time.</p><br>";
print"Please <a href=/fishingreports/index.php><img src=/images/arrowleft.gif border=0><div class=boxbody>go back and try again!</div</a>";
print"</center>";
}
mysql_close($Link);