Skip to content

Instantly share code, notes, and snippets.

@johnsonch
Created July 28, 2011 00:19
Show Gist options
  • Save johnsonch/1110652 to your computer and use it in GitHub Desktop.
Save johnsonch/1110652 to your computer and use it in GitHub Desktop.
Simple PHP Contact form and response
<?PHP
$top = "<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd"><html>";
$bottom = "<body></body></html>";
$blank = ' ';
$sep = "\r\n";
$subject = $_POST['subject'];
$name = $_POST['name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$message = $_POST['message'];
$contact = $_POST['email'] .$blank .$_POST['phone'];
$body = $name .$sep .$email .$sep .$phone .$sep .$subject .$sep .$message;
mail('info@asdps.com',$subject, $body);
echo ("Thank you for contacting us, " .$name."<br> Your message: <b>");
echo $subject;
echo "</b>, has been recieved</br> A response will be sent to you in a timely fashion. <br><br> Have a wonderful day! <br> -ASDPS";
?>
<form action="contact_response.php" method="post" name="frm_contact" id="frm_contact">
<table width="650" border="0" cellspacing="0" cellpadding="1">
<tr>
<td width="8">&nbsp;</td>
<td width="638"><table width="90%" height="224" border="0" cellpadding="1" cellspacing="0">
<tr bgcolor="#FFFFFF">
<td width="22%"><span class="style4 style1 style4 style6">Name</span></td>
<td width="78%"><input name="name" type="text" id="name2" size="50"></td>
</tr>
<tr bgcolor="#FFFFFF">
<td><span class="style4 style1 style4 style6">E-Mail</span></td>
<td><input name="email" type="text" id="email" size="50"></td>
</tr>
<tr bgcolor="#FFFFFF">
<td><span class="style4 style1 style4 style6">Phone</span></td>
<td><input name="phone" type="text" id="phone" size="50"></td>
</tr>
<tr bgcolor="#FFFFFF">
<td><span class="style4 style1 style4 style6">Subject</span></td>
<td><input name="subject" type="text" id="subject" onBlur="MM_validateForm('name2','','R','email','','RisEmail','phone','','R','message','','R');return document.MM_returnValue" size="50"></td>
</tr>
<tr bgcolor="#FFFFFF">
<td><span class="style4 style1 style4 style6">Comments</span></td>
<td><textarea name="message" cols="50" rows="5" id="message"></textarea></td>
</tr>
<tr bgcolor="#FFFFFF">
<td colspan="2"><div align="center">
<input type="submit" name="Submit" value="Submit">
</div></td>
</tr>
</table> <p>&nbsp; </p>
</td>
</tr>
</table>
<p>&nbsp;</p>
</form>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment