Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.77 KB | None | 0 0
  1.  
  2. <div class="col-md-7 contact-form wow animated fadeInLeft">
  3. <?php
  4. $alert = function($type, $message) {
  5. return "
  6. <div class=\"alert alert-$type\" role=\"alert\">$message</div>
  7. ";
  8. };
  9.  
  10. if(isset($_POST['send'])) {
  11. $to = 'bok@serwer.pl'; // na jaki adres ma przyjsc wiadomosc
  12. $from = @$_POST['email'];
  13. $name = @$_POST['name'];
  14. $subject = "Wiadomość z formularza od $name.";
  15. $content = @$_POST['message'];
  16. $header = "From: $from \nContent-Type:" .
  17. ' text/plain;charset="iso-8859-2"' .
  18. "\nContent-Transfer-Encoding: 8bit";
  19.  
  20. if (empty($from)) {
  21. echo $alert("info", "Podaj adres email.");
  22. } elseif (empty($name)) {
  23. echo $alert("info", "Podaj swoje imię.");
  24. } elseif (!mail($to, $subject, $content, $header)) {
  25. echo $alert("danger", "Nie można wysłać wiadomości.");
  26. } else {
  27. echo $alert("success", "Widomość została wysłana.");
  28. }
  29. }
  30. ?>
  31.  
  32. <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
  33. <div class="input-field">
  34. <input type="text" name="name" class="form-control" placeholder="Twoje imię...">
  35. </div>
  36. <div class="input-field">
  37. <input type="email" name="email" class="form-control" placeholder="Twój e-mail...">
  38. </div>
  39. <div class="input-field">
  40. <textarea name="message" class="form-control" placeholder="Twoja wiadomość..."></textarea>
  41. </div>
  42. <button type="submit" name="send" id="submit" class="btn btn-blue btn-effect">Wyślij</button>
  43. </form>
  44. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement