View Single Post
Join Date: Sep 2007
Posts: 1,337
Reputation: cwarn23 has a spectacular aura about cwarn23 has a spectacular aura about 
Solved Threads: 126
cwarn23's Avatar
cwarn23 cwarn23 is offline Offline
Nearly a Posting Virtuoso

Re: PHP Feedback Form

 
0
  #2
Dec 2nd, 2008
I have made a standard email form and is below. The only thing you need to change is the variable $address (about line 4) to your real email address to receive website emails. Also this email form supports html formatting.
  1. <?
  2. if (isset($_POST['subject']) && $_POST['message']!=='')
  3. {
  4. $address = "your_real_email@domain.com"; //change this to the receiving address.
  5. $subject = "Website Email: ".$_POST['subject'];
  6. if ($_POST['name']!=='')
  7. {
  8. $body = "<table border=0 cellpadding=5 cellspacing=0 width=200><tr><td>".$_POST['message']."<br>
  9. <br>
  10. Yours Sincerely<br>
  11. ".$_POST['name']."</td></tr></table>";
  12. } else {
  13. $body = "<table border=0 cellpadding=5 cellspacing=0 width=200><tr><td>".$_POST['message'].
  14. "</td></tr></table>";
  15. }
  16. $headers = 'MIME-Version: 1.0' . "\r\n";
  17. $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
  18. $headers .= 'From: do_not_reply@your_website_form' . "\r\n";
  19.  
  20. mail($address,$subject,$body,$headers);
  21. }
  22. //below displays the form while above processes it.
  23. echo "<form method='post'>Subject: <input type=text value='' maxlength=100 name='subject' size=30><br>
  24. <textarea cols=30 rows=20 name='message'></textarea><br>Name: <input type='text' value='' name='name'>
  25. <input type='submit' value='submit'></form>";
  26. ?>
Try not to bump 10 year old threads as it can be really annoying.
Like php then read my website at http://syntax.cwarn23.net/
Star-Trek-Atlantis - now that's what I call a movie ^_^
My favourite PC. - MacGyver Fan
Bad english note: dis-iz-2b4u
Reply With Quote