Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]Formularz kontaktowy, Brak polskich liter
--pietro--
post 25.07.2013, 01:47:21
Post #1





Goście







Wstawiłem na stronę html skrypt formularza kontaktowego znaleziony w internecie. Przy testowaniu wszystko było OK, bo do testów używałem swojej skrzynki na poczta.interia.pl. Natomiast gdy maile zaczeły byc wysyłane na skrzynke poczta.o2.pl, zaczeły się problemy, bo wiadomości zaczeły dochodzic bez polskich znaków.


Skrypt wygląda tak. Jeśli możecie mi doradzic co zmienic , i dokładnie w którym miejscu - będę bardzo wdzięczny.
  1. <?php
  2.  
  3.  
  4. if(isset($_POST['Email_Address'])) {
  5.  
  6. include 'freecontactformsettings.php';
  7.  
  8. function died($error) {
  9. echo "Sorry, but there were error(s) found with the form you submitted. ";
  10. echo "These errors appear below.<br /><br />";
  11. echo $error."<br /><br />";
  12. echo "Please go back and fix these errors.<br /><br />";
  13. die();
  14. }
  15.  
  16. if(!isset($_POST['Full_Name']) ||
  17. !isset($_POST['Email_Address']) ||
  18. !isset($_POST['Telephone_Number']) ||
  19. !isset($_POST['Your_Message']) ||
  20. !isset($_POST['AntiSpam'])
  21. ) {
  22. died('Niestety występuje problem w formularzu.');
  23. }
  24.  
  25. $full_name = $_POST['Full_Name']; // required
  26. $email_from = $_POST['Email_Address']; // required
  27. $telephone = $_POST['Telephone_Number']; // not required
  28. $comments = $_POST['Your_Message']; // required
  29. $antispam = $_POST['AntiSpam']; // required
  30.  
  31. $error_message = "";
  32.  
  33. $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
  34. if(preg_match($email_exp,$email_from)==0) {
  35. $error_message .= 'Wprowadzony adres e-mail nie jest poprawny.<br />';
  36. }
  37. if(strlen($full_name) < 2) {
  38. $error_message .= 'Nazwisko zostało błędnie wpisanenie.<br />';
  39. }
  40. if(strlen($comments) < 2) {
  41. $error_message .= 'Wpisz wiadomość.<br />';
  42. }
  43.  
  44. if($antispam <> $antispam_answer) {
  45. $error_message .= 'Odpowiedź na pytanie nie jest prawidłowa.<br />';
  46. }
  47.  
  48. if(strlen($error_message) > 0) {
  49. died($error_message);
  50. }
  51. $email_message = "Wiadomość wysłana ze strony wykrojekrawieckie.pl.\r\n";
  52.  
  53. function clean_string($string) {
  54. $bad = array("content-type","bcc:","to:","cc:");
  55. return str_replace($bad,"",$string);
  56. }
  57.  
  58. $email_message .= "Imię i nazwisko: ".clean_string($full_name)."\r\n";
  59. $email_message .= "e-mail: ".clean_string($email_from)."\r\n";
  60. $email_message .= "Telefon: ".clean_string($telephone)."\r\n";
  61. $email_message .= "Wiadomość: ".clean_string($comments)."\r\n";
  62.  
  63. $headers = 'From: '.$email_from."\r\n".
  64. 'Reply-To: '.$email_from."\r\n" .
  65. 'X-Mailer: PHP/' . phpversion();
  66. mail($email_to, $email_subject, $email_message, $headers);
  67. header("Location: $thankyou");
  68. ?>
  69. <script>location.replace('<?php echo $thankyou;?>')</script>
  70. <?php
  71. }
  72. die();
  73. ?>
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: 13.07.2025 - 13:02