Posted By

rwczippy on 10/07/09


Tagged

form email php


Versions (?)

PHP basic E-mail form


 / Published in: PHP
 

URL: http://www.w3schools.com/php/php_secure_mail.asp

from http://www.w3schools.com/php/php_mail.asp

  1. <?php
  2. if (isset($_REQUEST['email']))
  3. //if "email" is filled out, send email
  4. {
  5. //send email
  6. $email = $_REQUEST['email'] ;
  7. $subject = $_REQUEST['subject'] ;
  8. $message = $_REQUEST['message'] ;
  9. mail("[email protected]", "Subject: $subject",
  10. $message, "From: $email" );
  11. echo "Thank you for using our mail form";
  12. }
  13. else
  14. //if "email" is not filled out, display the form
  15. {
  16. echo "<form method='post' action='mailform.php'>
  17. Email: <input name='email' type='text' /><br />
  18. Subject: <input name='subject' type='text' /><br />
  19. Message:<br />
  20. <textarea name='message' rows='15' cols='40'>
  21. </textarea><br />
  22. <input type='submit' />
  23. </form>";
  24. }
  25. ?>

Report this snippet  

You need to login to post a comment.