Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Formularz kontaktowy - gdzie błąd?
interlaw
post
Post #1





Grupa: Zarejestrowani
Postów: 5
Pomógł: 0
Dołączył: 29.05.2016

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


Koleżanki, Koledzy!

Pomóżcie mi proszę odnaleźć błąd w skrypcie, formularz nie działa (wiadomości nie dochodzą).

HTML:

  1. <div class="col-md-5 col-sm-5">
  2.  
  3. <div class="vertical-registration-form">
  4. <div class="colored-line">
  5. </div>
  6. <h3>bezpłatny kontakt</h3>
  7. <form class="registration-form" id="register" role="form">
  8. <input class="form-control input-box" id="name" type="text" name="name" placeholder="Imię i nazwisko">
  9. <input class="form-control input-box" id="email" type="email" name="email" placeholder="E-mail">
  10. <input class="form-control input-box" id="phone-number" type="text" name="phone-number" placeholder="Numer telefonu">
  11. <button class="btn standard-button" type="submit" id="submit" name="submit">Wyślij</button>
  12. </form>
  13. </div>
  14. </div>
  15. </div>
  16.  
  17. </div>
  18.  
  19. </div>


PHP:

  1. <?php
  2. // Email Submit
  3. // Note: filter_var() requires PHP >= 5.2.0
  4. if ( isset($_POST['email']) && isset($_POST['name']) && isset($_POST['subject']) && isset($_POST['message']) && filter_var($_POST['email'], FILTER_VALIDATE_EMAIL) ) {
  5.  
  6. // detect & prevent header injections
  7. $test = "/(content-type|bcc:|cc:|to:)/i";
  8. foreach ( $_POST as $key => $val ) {
  9. if ( preg_match( $test, $val ) ) {
  10. }
  11. }
  12.  
  13. $headers = 'From: ' . $_POST["name"] . '<' . $_POST["email"] . '>' . "\r\n" .
  14. 'Reply-To: ' . $_POST["email"] . "\r\n" .
  15. 'X-Mailer: PHP/' . phpversion();
  16.  
  17. //
  18. mail( "MÓJ.ADRES.MAILOWY", $_POST['subject'], $_POST['message'], $headers );
  19.  
  20. // ^
  21. // Replace with your email
  22. }
  23. ?>
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 Aktualny czas: 22.08.2025 - 10:05