Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Brak polskich znaków w E-mail'u PHP
robin552
post
Post #1





Grupa: Zarejestrowani
Postów: 1
Pomógł: 0
Dołączył: 5.09.2015

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


Witam, napisałem swoją pierwszą stronkę z formularzem kontaktowym, który znalazłem na internecie. Wszystko pięknie działa, oprócz E-mail'i, które przychodzą bez polskich znaków. Jak ustawić kodowanie, aby zamiast krzaczków zobaczyć, piękne Polskie ogonki? (IMG:style_emoticons/default/smile.gif) I gdzie to "dokleić" do mojego kodu?

  1. <?php
  2. if (isset($_POST["submit"])) {
  3. $name = $_POST['name'];
  4. $email = $_POST['email'];
  5. $message = $_POST['message'];
  6. $human = intval($_POST['human']);
  7. $from = 'Formularz kontaktowy';
  8. $to = 'kontakt@kontakt.pl';
  9. $subject = 'Formularz kontaktowy';
  10. $body ="From: $name\n E-Mail: $email\n Message:\n $message";
  11. // Check if name has been entered
  12. if (!$_POST['name']) {
  13. $errName = 'Proszę, wprowadź poprawne Imię';
  14. }
  15.  
  16. // Check if email has been entered and is valid
  17. if (!$_POST['email'] || !filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) {
  18. $errEmail = 'Proszę, wprowadź poprawny adres E-mail';
  19. }
  20.  
  21. //Check if message has been entered
  22. if (!$_POST['message']) {
  23. $errMessage = 'Proszę, wpisz swoją wiadomość';
  24. }
  25. //Check if simple anti-bot test is correct
  26. // If there are no errors, send the email
  27. if (!$errName && !$errEmail && !$errMessage) {
  28. if (mail ($to, $subject, $body, $from)) {
  29. $result='<div class="alert alert-success">Dzięki za wysłanie wiadomości!</div>';
  30. } else {
  31. $result='<div class="alert alert-danger">UPS, coś poszło nie tak. Spróbuj ponownie później</div>';
  32. }
  33. }
  34. }
  35. ?>
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Aktualny czas: 25.08.2025 - 04:52