Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [AJAX][PHP] Błąd w formularzu
Michalo1994
post
Post #1





Grupa: Zarejestrowani
Postów: 93
Pomógł: 0
Dołączył: 3.02.2009

Ostrzeżenie: (20%)
X----


Mam darmowy skrypt PHP&ajax - formularz kontaktowy. Niestety po wrzuceniu na hosting home.pl - nie działa - wyświetla się komunikat "spróbuj ponownie".
Mógłby mi ktoś pomóc w znalezieniu przyczyny? Kod php formularza poniżej:
  1. <?php
  2.  
  3. // Define some constants
  4. define( "RECIPIENT_NAME", "Imię i nazwisko" );
  5. define( "RECIPIENT_EMAIL", "moj.email@ow.pl" );
  6. define( "EMAIL_SUBJECT", "Zapytanie" );
  7.  
  8. // Read the form values
  9. $success = false;
  10. $senderName = isset( $_POST['senderName'] ) ? preg_replace( "/[^\.\-\' a-zA-Z0-9]/", "", $_POST['senderName'] ) : "";
  11. $senderEmail = isset( $_POST['senderEmail'] ) ? preg_replace( "/[^\.\-\_\@a-zA-Z0-9]/", "", $_POST['senderEmail'] ) : "";
  12. $message = isset( $_POST['message'] ) ? preg_replace( "/(From:|To:|BCC:|CC:|Subject:|Content-Type:)/", "", $_POST['message'] ) : "";
  13.  
  14. // If all values exist, send the email
  15. if ( $senderName && $senderEmail && $message ) {
  16. $recipient = RECIPIENT_NAME . " <" . RECIPIENT_EMAIL . ">";
  17. $headers = "From: " . $senderName . " <" . $senderEmail . ">";
  18. $success = mail( $recipient, EMAIL_SUBJECT, $message, $headers );
  19. }
  20.  
  21. // Return an appropriate response to the browser
  22. if ( isset($_GET["ajax"]) ) {
  23. echo $success ? "success" : "error";
  24. } else {
  25. ?>
  26. <html>
  27. <head>
  28. <title>Dziękujemy!</title>
  29. </head>
  30. <body>
  31. <?php if ( $success ) echo "<p>Wiadomość wysłana!.</p>" ?>
  32. <?php if ( !$success ) echo "<p>Spróbuj ponownie.</p>" ?>
  33. <p>Kliknij wstecz aby wrócić.</p>
  34. </body>
  35. </html>
  36. <?php
  37. }
  38. ?>


Ten post edytował Michalo1994 20.08.2014, 20:50:52
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: 21.08.2025 - 22:26