Advertisement
rolandixor

contactform test

Jun 4th, 2016
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. <?php
  2. $name = $_POST['name'];
  3. $email = $_POST['email'];
  4. $message = $_POST['message'];
  5. $from = 'From: Bob';
  6. $to = 'rolandixor@gmail.com';
  7. $subject = 'Hello';
  8. $human = $_POST['human'];
  9. $body = "From: $name\n E-Mail: $email\n Message:\n $message";
  10. if ($_POST['submit']) {
  11. if ($name != '' && $email != '') {
  12. if ($human == '4') {
  13. if (mail ($to, $subject, $body, $from)) {
  14. echo '<p>Your message has been sent!</p>';
  15. } else {
  16. echo '<p>Something went wrong, go back and try again!</p>';
  17. }
  18. } else if ($_POST['submit'] && $human != '4') {
  19. echo '<p>You answered the anti-spam question incorrectly!</p>';
  20. }
  21. } else {
  22. echo '<p>You need to fill in all required fields!!</p>';
  23. }
  24. }
  25. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement