php形式的希腊语支持

时间:2014-03-30 12:51:30

标签: php html forms encoding character-encoding

我使用这个php联系表单,但它不支持希腊语!

<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>My Contact Form</title>
</head>
<body>
<form method="POST" action="mailer.php">
 ONOMA:
 <input type="text" name="name" size="19"><br>
 <br>
 EMail:
 <input type="text" name="email" size="19"><br>
 <br>
 <input type="checkbox" name="check[]" value="blue"> MPLE<br>
 <input type="checkbox" name="check[]" value="green"> PRASSINO<br>
 <input type="checkbox" name="check[]" value="orange"> PORTOKALI <br>
 <br>
 <input type="radio" value="yes" name="radio"> NAI<br>
 <input type="radio" value="no" name="radio"> OXI
 <br>
 <br>
 <select size="1" name="drop_down">
 <option>php</option>
 <option>xml</option>
 <option>asp</option>
 <option>jsp</option>
 </select><br>
 <br>
 MHNYMA:<br>
 <textarea rows="9" name="message" cols="30"></textarea><br>
 <br>
 <input type="submit" value="Submit" name="submit">
</form>
</body>
</html>

mailer.php

<?php
if(isset($_POST['submit'])) {
 $to = "email@email.gr";
 $subject = "Form Contact Form";
 $name_field = $_POST['name'];
 $email_field = $_POST['email'];
 $message = $_POST['message'];
 $option = $_POST['radio'];
 $dropdown = $_POST['drop_down'];
 foreach($_POST['check'] as $value) {
 $check_msg .= "Checked: $value\n";
 }
 $body = "From: $name_field\n E-Mail: $email_field\n $check_msg Option: $option\n Drop-Down: $dropdown\n Message:\n $message\n";
 echo "Your Mail Was Sent To $to!";
 mail($to, $subject, $body);
} else {
 echo "Error";
}
?>

感谢任何帮助!

1 个答案:

答案 0 :(得分:0)

在元标记中尝试charset=UTF-8。还要确保在您使用的任何文本编辑器中使用UTF-8(而不是ANSI)编码保存文件。从文件菜单

中选择“另存为”时,应显示该选项