Contact Me
(all fields are required)
|
Code Below
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Contact Me</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<style type="text/css">
<!--
body {
background: #ffffff;
margin: 10px;
padding: 10px;
font-family: 'Trebuchet MS', Arial, sans-serif;
color: #000000;
font-size: 16.5px;
}
.tablmain {
width: 600px;
margin-left: auto;
margin-right: auto;
}
h1, h2, h3, h4, h5 {
font-family: Georgia, 'Times New Roman', serif;
}
h1 {
font-size: 26px;
text-align: center;
margin-top: 25px;
}
h2 {
font-size: 22px;
color: #000000;
text-align: center;
margin-top: 25px;
}
.center {
text-align: center;
}
.note {
font-size: 12px;
text-align: center;
}
a:link {
background: #000000;
color: #FFFF00;
text-decoration: none;
}
a:visited {
background: transparent;
color: #00FF00;
text-decoration: none;
}
-->
</style>
</head>
<body>
<?php
if ( $_POST[submit] )
{
########################################
##### CHANGE TO YOUR EMAIL ADDRESS #####
$to = "your_email@yahoo.com";
$name = $_POST['name'];
$email = $_POST['email'];
$subject = $_POST['subject'];
$msg = $_POST['msg'];
$d = date('l dS \of F Y h:i:s A');
$sub = "Web Form Mail";
$headers = "MIME-Version: 1.0\n";
$headers .= "Content-Type: text/plain; charset=iso-8859-1\n";
$headers .= "From: $name <$email>\n";
$mes = "Subject: ".$subject."\n";
$mes .= "Message: ".$msg."\n";
$mes .= "Name: ".$name."\n";
$mes .= 'Email: '.$email."\n";
$mes .= 'Date & Time: '.$d;
if (empty($name) || empty($email) || empty($subject) || empty($msg))
{
echo "<h2>Sorry all fields are required.</h2>";
exit;
}
elseif(!ereg("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)) {
echo "<h2>Sorry the email address you entered looks like it's invalid.</h2>";
exit;
}
else
{
mail($to, $sub, $mes, $headers);
echo "<h2>Thank you ".$name." for contacting us.<br>We will get back to you as soon as possible</h2>\n";
echo "<p class=\"center\"><a href=\"/\">Home</a></p>";
}
exit;
}
?>
<div>
<table class="tablmain" cellpadding="0" cellspacing="0" border="0">
<tr>
<td align="center">
<h1>Contact Me</h1>
<span class="note">(all fields are required)</span>
<form method="post" action="">
<table cellpadding="0" cellspacing="8" border="0">
<tr>
<td align="right">Name:</td><td align="left"><input type="text" name="name" size="30"></td>
</tr>
<tr>
<td align="right">Email:</td><td align="left"><input type="text" name="email" size="30"></td>
</tr>
<tr>
<td align="right">Subject:</td><td align="left"><input type="text" name="subject" size="30"></td>
</tr>
<tr>
<td align="right" valign="top">Message:</td><td align="left"><textarea name="msg" cols="30" rows="6" value="No HTML Please" onfocus="if(this.value==this.defaultValue){this.value='';}" onblur="if(this.value=='')this.value=this.defaultValue"></textarea></td>
</tr>
<tr>
<td> </td><td align="left"><input type="submit" name="submit" value="Send">  <input type="button" value="Reset"></td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</div>
</body>
</html>
|