我的问题是,当我使用联系表格发送泰语时,当我收到电子邮件时,编码变得非常奇怪。但它不会发生在英语中。通常,泰语对网站使用 TIS-620 编码,所以我也将它放在页面的标题中。
这是我使用联系表格收到的电子邮件:
姓名:א×�°��·�ל ����·��¹¹·ל 电子邮件:melo6767@hotmail.com 电话:0811234472 留言:¤��¼����¼י����¹�ל���� 上一页 ��µי�§¹�´��ה���§ה§÷י�§ µ�´µט�·�§ג·���¾·לה´יא��¤��÷ 电子邮件�� ¨¨ ...
我不知道该怎么做,因为我对 PHP 一无所知。请帮忙。
这是我的联系表格编码
<div class="contactform">
<?php
if (isset($_REQUEST['email'])){
$mailcheck = spamcheck($_REQUEST['email']);
if (($mailcheck==FALSE) || (!$_REQUEST['name']) || (!$_REQUEST['subject'] || (!$_REQUEST['message']))){
if(isset($_POST['name'])){
$name = $_POST['name'];
}
if (isset($_POST['email'])){
$email = $_POST['email'];
}
if (isset($_POST['phone'])){
$phone = $_POST['phone'];
}
if (isset($_POST['subject'])){
$subject = $_POST['subject'];
}
if (isset($_POST['message'])){
$message = $_POST['message'];
}
$form = "<div class=\"indent\"><form method=\"post\" action=\"contactus.php?pg=5\">";
$form .= "<p class='textred indent'>Name / ชื่อ-นามสกุล * </p>";
$form .= "<input name=\"name\" type=\"text\" value=\"".htmlentities($name)."\" />";
$form .= "<br />";
$form .= "<p class=\"textred indent\">Email / อีเมล * </p>";
$form .= "<input name=\"email\" type=\"text\" value=\"".htmlentities($email)."\"/>";
$form .= "<br />";
$form .= "<p class=\"indent\">Phone / เบอร์โทรศัพท์ </p>";
$form .= "<input name=\"phone\" type=\"text\" value = \"".htmlentities($phone)."\" />";
$form .= "<br />";
$form .= "<p class=\"textred indent\">Subject / หัวข้อ * </p>";
$form .= "<input name=\"subject\" type=\"text\" value = \"".htmlentities($subject)."\" />";
$form .= "<br />";
$form .= "<p class=\"textred indent\">Message / ข้อความ * </p>";
$form .= "<textarea name='message' rows='17' cols='46'>".htmlentities($message)."</textarea><br />";
$form .= "<img src=\"captcha.php\" id=\"captcha\" /><br/>
<a href=\"#\" onclick=\"
document.getElementById('captcha').src='captcha.php?'+Math.random();
document.getElementById('captcha-form').focus();\"
id=\"change-image\"><p style='font-size:12px;'>Change text.</p></a><br/>
<p class='textred indent'>Enter code above*</p>
<input type=\"text\" name=\"captcha\" id=\"captcha-form\" autocomplete=\"off\" /><br/>
<input type='submit' />
</form> <p class='textred'>*Please provide the necessary details. กรุณาใส่ข้อมูลให้ถูกต้อง</p></div>";
echo $form;
}else{
$name = $_REQUEST['name'] ;
$email = $_REQUEST['email'] ;
$phone = $_REQUEST['phone'] ;
$subject = $_REQUEST['subject'] ;
$message = $_REQUEST['message'] ;
$toEmail = 'info@culfix.com';
$messageBody = "Name: ". $_REQUEST['name']. "\n";
$messageBody .="Email: ". $_REQUEST['email']. "\n";
$messageBody .="Phone: ". $_REQUEST['phone']. "\n";
$messageBody .="Message: ". $_REQUEST['message']. "\n";
$mailHeader = "From: ". $_REQUEST['email']."\r\n";
$mailHeader .= "Reply-To: ". $_REQUEST['email']."\r\n";
mail($toEmail, $subject, $messageBody, $mailHeader);
header("Location:email.php?pg=5");
ob_end_finish();
}
}else{
echo "<div class=\"indent\">
<form method='post' action='contactus.php?pg=5'>
<p class=\"indent\">Name / ชื่อ-นามสกุล * </p>
<input name='name' type='text' />
<br />
<p class=\"indent\">Email / อีเมล * </p>
<input name='email' type='text' />
<br />
<p class=\"indent\">Phone / เบอร์โทรศัพท์ </p>
<input name='phone' type='text' />
<br />
<p class=\"indent\">Subject / หัวข้อ * </p>
<input name='subject' type='text' />
<br />
<p class=\"indent\">Message / ข้อความ *</p>
<textarea name='message' rows='17' cols='46'></textarea><br />
<div class='indent'><img src=\"captcha.php\" id=\"captcha\" /></div>
<a href=\"#\" onclick=\"
document.getElementById('captcha').src='captcha.php?'+Math.random();
document.getElementById('captcha-form').focus();\"
id=\"change-image\"><p style='font-size:12px;'>Change text.</p></a><br/>
<p class='indent'>Enter code above</p>
<input type=\"text\" name=\"captcha\" id=\"captcha-form\" autocomplete=\"off\" /> <br/>
<input type='submit' />
</form></div>";
}
?>
</div>