2017-05-11 12 views
0

私のフォームと電子メールハンドラは、入力からUTF-8文字を送信しません。電子メールは正しく動作していますが、UTF-8文字をサポートしていますが、フォーム入力から取得したものは正しくコーディングされていません。この時点で、何が間違っているのか分からない。HTMLフォームは入力からUTF-8文字を送信しません。 PHP、MOODLE

    <form id="demo_form" action="/local/landing/demo.php" accept-charset='UTF-8'> 
        <div class="form-text"> 
         <div class="form-text-row"> 
          <input class="input1 input_all" type="text" required name="name" size="20" placeholder="Imię" /> 
          <input class="input2 input_all" type="text" required name="surname" size="20" placeholder="Nazwisko" /> </div> 
         <div class="form-text-row"> 
          <input class="input1 input_all" type="email" required name="email" size="20" placeholder="Służbowy adres e-mail" /> 
          <input class="input2 input_all" type="text" required name="telephone" size="20" placeholder="Telefon" /> </div> 
         <div class="form-text-row"> 
          <input class="input1 input_all" type="text" required name="position" size="20" placeholder="Stanowisko" /> 
          <input class="input2 input_all" type="text" required name="company" size="20" placeholder="Nazwa firmy" /> </div> 
         <div class="form-text-row"> 
          <div class="form-response"></div> 
          <input type="submit" value="Wyślij" /> 
         </div> 
        </div> 

のindex.phpヘッダ<meta http-equiv="Content-Type" content="text/html; charset=windows-UTF-8">

PHPの電子メールハンドラ

if (!empty($pairs)) { 
foreach ($pairs as $pair) { 
    list($name, $value) = explode('=', $pair); 
    $inputs->$name = $value; 
} 

$inputs->demo = get_string($inputs->meet, 'land'); 

$user = $DB->get_record('user', array('id' => 2)); 
$user->email = '[email protected]'; 
$supportuser = core_user::get_support_user(); 
$subject = get_string('subject', 'land'); 
$html = get_string('message', 'land', $inputs); 
$text = strip_tags($html); 
if (email_to_user($user, $supportuser, $subject, $text, $html)) { 
    $response = 1; 
} else { 
    $response = get_string('cannot_send', 'land'); 
} 

}

$string['message'] = ' charset=windows-UTF-8"><p>Wysłano z formularza kontaktowego na stronie logowania.</p> 
<p>{$a->name} {$a->surname}<br> 
<i>"{$a->position}"</i> z firmy <i>"{$a->company}"</i> 
chciał/a by {$a->demo}.</p> 
<p>Dane kontaktowe:<br> 
email: {$a->email}<br> 
telefon: {$a->telephone}</p>'; 

答えて

0

<meta http-equiv="Content-Type" content="text/html; charset=windows-UTF-8"> 
を変更しようとします

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 

から

とUTF-8

1

に設定メールヘッダに私はこの問題は、AJAXであったことが分かった( - )をシリアライズ。

私はdecodeURIComponent(data)を使って入力からデータをデコードし、そのデータを処理しました。

関連する問題