Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]Bootstrap - polaczenie ramki modalnej z formularzem php
awek320
post 19.10.2017, 20:13:28
Post #1





Grupa: Zarejestrowani
Postów: 15
Pomógł: 0
Dołączył: 17.11.2014

Ostrzeżenie: (0%)
-----


Witam. Mam problem z wiadomoscia zwrotna w ramce modalnej.
Gdy jest blad wszystko jest ok. Ale gdy formularz sie wysle to strona sje odswieza.. i ramki nie ma..

Prosze o pomoc


  1. <!-- contact -->
  2.  
  3. <div class="contact-section">
  4. <div class="ear-piece">
  5. <img class="img-responsive" src="images/contact_graphic.png" alt="">
  6. </div>
  7. <div class="container">
  8. <div class="row">
  9. <div class="col-sm-3 col-sm-offset-4">
  10. <div class="contact-text">
  11. <h3>Kontakt</h3>
  12. <address>
  13.  
  14. </address>
  15. </div>
  16. </div>
  17. <div class="col-sm-5">
  18. <div id="contact-section">
  19. <h3>Zapytaj o wolny termin</h3>
  20. <form id="main-contact-form" class="contact-form" name="contact-form" method="post" action="<?php $wyslij ?>">
  21. <div class="form-group">
  22. <input type="text" name="name" class="form-control" required="required" placeholder="Imię i Nazwisko">
  23. </div>
  24. <div class="form-group">
  25. <input type="email" name="email" class="form-control" required="required" placeholder="Adres E-mail">
  26. </div>
  27. <div class="form-group">
  28. <input type="text" name="termin" class="form-control" required="required" placeholder="Termin imprezy">
  29. </div>
  30. <div class="form-group">
  31. <textarea name="message" id="message" required="required" class="form-control" rows="4" placeholder="Treść wiadomości"></textarea>
  32. </div>
  33. <div class="form-group">
  34. <button type="submit" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#myModal" name="wyslij">Wyślj</button>
  35. </div>
  36. </form>
  37. </div>
  38. </div>
  39. </div>
  40. </div>
  41. </div>
  42. </section>
  43.  
  44. <!-- wysylanie wiadomości-->
  45. <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
  46. <div class="modal-dialog" role="document">
  47. <div class="modal-content">
  48. <div class="modal-header">
  49. <h2 class="modal-title" id="myModalLabel"><p style="color: black;">Formularz kontaktowy</p></h2>
  50. </div>
  51. <div class="modal-body">
  52. <?php echo $item->body; ?>
  53. <p style="color: black;">
  54. <?php
  55. if ($_POST["wyslij"]) {
  56.  
  57. $name = @trim(stripslashes($_POST['name']));
  58. $email = @trim(stripslashes($_POST['email']));
  59. $termin = @trim(stripslashes($_POST['termin']));
  60. $subject = @trim(stripslashes($_POST['subject']));
  61. $message = @trim(stripslashes($_POST['message']));
  62. $email_from = $email;
  63. $email_to = 'slawek.krybus@gmail.com';//replace with your email
  64.  
  65. $body = 'Imię i Nazwisko: ' . $name . "\n\n" . 'Email: ' . $email . "\n" . 'Termin: ' . $termin . "\n\n" . $message;
  66.  
  67. $success = @mail($email_to, $subject, $body, 'From: <'.$email_from.'>');
  68. echo 'Wiadomość została wysłana';
  69. }
  70. else {
  71.  
  72. if (($name == "") || ($email == "") || ($termin == "") || ($message == ""))
  73.  
  74. echo 'Nie mozesz'; }
  75. ?>
  76. </p>
  77. </div>
  78. <div class="modal-footer">
  79. <button type="button" class="btn btn-primary pull" data-dismiss="modal">Powrót</button>
  80. </div>
  81. </div>
  82. </div>
  83. </div>
  84. <!--/#wysylanie wiadomości-->


Wiem ze kod php formularza jest zle napisany ale to i tak nie powinno ma poczatku miec jakies znaczenie
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 14.08.2025 - 08:38