我正在继续从以前的开发人员那里开发一个允许用户发送查询表单的网络。有些用户是中国人,因此他们在填写表格时倾向于使用汉字。当他们发送表格时,我收到的电子邮件会显示这个
å ‰éš†å ¡/雪兰莪州
有没有办法解决这个问题?这是代码
query_process.php:
<?php
session_start();
require_once "includes/phpmailer.php";
$name = mysql_real_escape_string($_POST['name']);
$email = mysql_real_escape_string($_POST['email']);
$subject = mysql_real_escape_string($_POST['subject']);
$message = mysql_real_escape_string($_POST['message']);
$subject = "[Website] Contact Form";
$body = "<p>Name: $name</p>
<p>Email: $email</p>
<p>Subject: $subject</p>
<p>Message : $message</p>
";
//$cf_mail_replyto
if(sendPHPMail('___', '___', '___', $subject, $body))
echo "success";
else
echo "fail";
?>
query_from.php:
...
function submitForm()
{
if($("#name").val() == "")
alert("Sorry, please fill in your name.");
else
if($("#email").val() == "")
alert("Sorry, please fill in your email.");
else
if($("#subject").val() == "")
alert("Sorry, please fill in your subject.");
else
if($("#message").val() == "")
alert("Sorry, please fill in your message.");
else
{
$.ajax({
type: "POST",
url: "query_process.php",
data: $("#enquiry").serialize(),
success: function(data){
if(data == "success"){
alert("Your enquiry has been sent successfully.");
window.location.reload();
}
else{
//console.log(data);
//alert(data);
alert("There's problem sending your enquiry. Please try again later.");
}
}
});
}
}
...
</script>
//my form
...