if($action == 'contact'){
//display the contact form
$sent = $_POST['sent'];
$from = $_POST['email'];
if($sent == 'yes'){
$to = '******@gmail.com ';
$subject = $_POST['subject'];
$message = $_POST['message'];
$type = $_POST['type'];
$message = wordwrap($message, 70);
$message= "The following E-Mail has been sent to you from index.php?action=contact
From:$from
Category:$type
Message:
$message
Sincerely,
Localspad.com
";
$message = nl2br("$message");
$headers = 'From: contact@localspad.com' . "\r\n" .
'Reply-To: noreply@localspad.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
echo "<P>Mail was sent.</P>";
}
else{
echo "
<table>
<form name='contact' METHOD=POST ACTION='index.php?action=contact'>
<tr>
<td colspan=4><center>Contact Form</center>
<tr>
<td>E-Mail:
<td><input type=TEXT name='email'><input type=HIDDEN name='sent' value='yes'>
<td>Category:
<td><SELECT NAME='type'>
<OPTION value='default' SELECTED>SELECT ONE:
<OPTION value='tech support'>Tech Support
<OPTION value='Report Infraction'>Report Infractions
<OPTION value'Report Bugs'>Report Bugs
</SELECT>
<tr><td>Message:<td colspan=4><textarea name='message' cols=40 rows=9></textarea>
<tr><td colspan=4><a style='float: right;' href='javascript: void(0);' onclick='document.contact.submit();return false;'>Submit E-Mail</a>
</form></table>
";
}
}