Posted By

tomdowning on 09/21/11


Tagged


Versions (?)

PHP Contact Form


 / Published in: PHP
 

  1. if (strtoupper($_SERVER['REQUEST_METHOD'])=="POST") {
  2. $fullname = $_POST['fullname'];
  3. $email = $_POST['email'];
  4. $phone = $_POST['phone'];
  5. $comment = $_POST['message'];
  6.  
  7. $mailSubject = "Look11 Website Contact Form";
  8. $headers = "From: " . '' . "
  9. ";
  10. $headers .= "Reply-To: ". '' . "
  11. ";
  12. $headers .= "MIME-Version: 1.0
  13. ";
  14. $headers .= "Content-Type: text/html; charset=ISO-8859-1
  15. ";
  16.  
  17. $message = 'FROM: ' . $fullname . '<br>';
  18. $message .= 'EMAIL: ' . $email . '<br>';
  19. $message .= 'PHONE: ' . $phone . '<br>';
  20. $message .= 'MESSAGE: ' . $comment . '<br>';
  21.  
  22. mail('', $mailSubject, $message, $headers);
  23. }
  24.  
  25.  
  26. /*CSS*/
  27. /* CONTACT FORM STYLING */
  28.  
  29. .contactForm {
  30. clear: left;
  31. margin-top: 15px;
  32. }
  33.  
  34. .contactForm input[type=text] {
  35. height: 20px;
  36. width: 400px;
  37. }
  38.  
  39. .contactForm input[type=text], .contactForm textarea {
  40. background: white;
  41. border: none;
  42. padding: 3px;
  43. font-size: 12px;
  44. margin: 3px 0 3px 0;
  45. }
  46.  
  47. .contactForm textarea {
  48. width: 400px;
  49. height: 100px;
  50. }
  51.  
  52. .sendBtn {
  53. cursor: pointer;
  54. height: 21px;
  55. float: left;
  56. line-height: 21px;
  57. color: white;
  58. font-size: 10px;
  59. padding: 0 3px 0 3px;
  60. background: #e30043;
  61. margin-top: 10px;
  62. }
  63.  
  64. .sendBtn img {
  65. float: right;
  66. }
  67.  
  68.  
  69. <form method="post" action="/contact/" id="contactForm" name="contactForm">
  70. <p class="lightgrey">Name:</p><input type="text" name="fullname"></input><br /><br />
  71. <p class="lightgrey">Email Address:</p><input type="text" name="email"></input><br /><br />
  72. <p class="lightgrey">Phone Number:</p><input type="text" name="phone"></input><br /><br />
  73. <p class="lightgrey">Message:</p><textarea name="message"></textarea><br />
  74. </form>
  75. <div class="sendBtn" onclick="checkFields();">SEND<img src='/images/searchBtn.gif' /></div>

Report this snippet  

You need to login to post a comment.