Advertisement
rolandixor

contactform test

Jun 4th, 2016
155
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. $subject = 'Hello';
  7. $human = $_POST['human'];
  8. $body = "From: $name\n E-Mail: $email\n Message:\n $message";
  9. if ($_POST['submit']) {
  10. if ($name != '' && $email != '') {
  11. if ($human == '4') {
  12. if (mail ($to, $subject, $body, $from)) {
  13. echo '<p>Your message has been sent!</p>';
  14. } else {
  15. echo '<p>Something went wrong, go back and try again!</p>';
  16. }
  17. } else if ($_POST['submit'] && $human != '4') {
  18. echo '<p>You answered the anti-spam question incorrectly!</p>';
  19. }
  20. } else {
  21. echo '<p>You need to fill in all required fields!!</p>';
  22. }
  23. }
  24. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement