Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Problem z kodowaniem->mail php, Problem...
senior.pol
post
Post #1





Grupa: Zarejestrowani
Postów: 158
Pomógł: 0
Dołączył: 10.08.2011

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


Witam
Mam pytanie odnośnie mojego kodu w php.
Wszystko pięknie działa, tylko nie ma polskich znaków. Wiem ,że coś jest w kodowaniu ,ale jestem amatorem w php i nie wiem co zrobić. Szukałem i czytałem wiele postów google ,nic mi to nie pomogło. Poniżej przedstawiam kod:
  1. <?php
  2.  
  3. if(!$_POST) exit;
  4.  
  5. $email = $_POST['email'];
  6.  
  7.  
  8. //$error[] = preg_match('/\b[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b/i', $_POST['email']) ? '' : 'INVALID EMAIL ADDRESS';
  9. if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$email )){
  10. $error.="Invalid email address entered";
  11. $errors=1;
  12. }
  13. if($errors==1) echo $error;
  14. else{
  15. $values = array ('name','email','message');
  16. $required = array('name','email','message');
  17.  
  18. $your_email = "tutaj@mojemail.com";
  19. $email_subject = "New Message: ".$_POST['subject'];
  20. $email_content = "new message:\n";
  21.  
  22. foreach($values as $key => $value){
  23. if(in_array($value,$required)){
  24. if ($key != 'subject' && $key != 'company') {
  25. if( empty($_POST[$value]) ) { echo 'PLEASE FILL IN REQUIRED FIELDS'; exit; }
  26. }
  27. $email_content .= $value.': '.$_POST[$value]."\n";
  28. }
  29. }
  30.  
  31. if(@mail($your_email,$email_subject,$email_content)) {
  32. echo 'Message sent!';
  33. } else {
  34. echo 'ERROR!';
  35. }
  36. }
  37. ?>

Proszę o pomoc. Z góry dziękuję (IMG:style_emoticons/default/smile.gif)
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: 3.10.2025 - 21:22