contact.php
<form action="<?php $_SERVER['PHP_SELF']; ?>">
<table width="100%" class="noborder" cellpadding="0" cellspacing="1">
<tr>
<td>Name</td>
<td><input type="text" name="name" /></td>
</tr>
<tr>
<td>Email</td>
<td><input type="text" name="email" /></td>
</tr>
<tr>
<td>Suject</td>
<td><select name="subject">
<option>Quote on a template</option>
<option>Quote on a script</option>
<option>Other</option>
</select></td>
</tr>
<tr>
<td>Message:</td>
<td><textarea name="message" cols="40" rows="5"></textarea></td>
</tr>
<tr>
<td colspan="2" style="text-align:center; "><input type="submit" name="submit" value="Send" /></td>
</tr>
<?php
$youremail = "matt@matt-license.com";
$subject = $_POST['subject'];
$thankyou = "Thank you. Your Email has been sent; I'll try to respond ASAP.";
$submit = $_POST['submit'];
if ( $_POST['submit'] ) {
if( $email == "" ) {
echo("<tr><td colspan='2' style='text-align:text-align:center; '>No email address added. Please go back.<br/></td></tr>");
}
elseif( $name == "" ) {
echo("<tr><td colspan='2' style='text-align:text-align:center; '>No name added. Please go back.<br/></td></tr>");
}
elseif( $message == "" ) {
echo("<tr><td colspan='2' style='text-align:text-align:center; '>No message added. Please go back.<br/></td></tr>");
}
}
else {
$msg = ereg_replace("\\\'", "'", $message);
$msg = ereg_replace('\\\"', "\"", $msg);
$message1 = "from: $name<br />email: $email<br />message:<br />$msg1";
mail($youremail, $subject, $msg, "From: $email\r\nReply-to: $email\r\n");
echo("<tr><td colspan='2' style='text-align:text-align:center; '>$thankyou</td></tr>");
}
?>
</table>
</form>
