Advertisement
firoze

HTML5 দিয়ে contact form ব্যবহার & message send

Dec 22nd, 2014
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. // Contact Form
  2. // Use in index.html or index.php or where do you need to show contact form paste there
  3.  
  4. <form action="form.php" method="post" enctype="multipart/form-data">
  5. <h1 class="title">Contact</h1>
  6. <label>Name</label>
  7. <input name="name" required="required" placeholder="Your Name">
  8. <label>Email Address</label>
  9. <input name="email" type="email" required="required" placeholder="Your Email">
  10. <label>Comment</label>
  11. <textarea name="message" cols="20" rows="5" required="required" placeholder="Message"></textarea>
  12. <input id="submit" name="submit" type="submit" value="Submit">
  13. </form>
  14.  
  15. // form.php (make a file name form.php)
  16. <?php
  17. $name = $_POST['name'];
  18. $email = $_POST['email'];
  19. $message = $_POST['message'];
  20. $from = 'From: YourWebsite.com';
  21. $to = 'yourmailID@gmail.com';
  22. $subject = 'Email Inquiry';
  23.  
  24. $body = "From: $name\n E-Mail: $email\n Message:\n $message";
  25. ?>
  26.  
  27. <?php
  28. if ($_POST['submit']) {
  29. if (mail ($to, $subject, $body, $from)) {
  30. echo '<p>Thank you for your email!</p>';
  31. } else {
  32. echo '<p>Oops! An error occurred. Try sending your message again.</p>';
  33. }
  34. }
  35. ?>
  36.  
  37.  
  38. // you can get more information from here http://pageaffairs.com/notebook/php-contact-form
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement