Hi
I am trying to create a web page that my readers could write me a feedback, press the Submit button and it will be sent to my email.
I used the UTF 8 meta in my code.
For some reason, the writen Hebrew wordes reaches my mail as signs like this:
׳”׳₪׳¢׳ ׳–׳” ׳™׳”׳™׳” ׳‘׳¢׳‘׳¨׳™׳×!
Can anyone please help me understand why the UTF-8 encoding doesn't work?
There is two files involved in the process, a main file containing the form and another file: send_mail.php
<html>
<head>
<title>The Title</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta http-equiv="content-language" content="he" />
</head>
<body>
<BODY TEXT="PINK" BGCOLOR="BLACK" LINK="RED">
<CENTER><h1>My Page</h1></CENTER><BR>
<HR>
<form action="send_mail.php" method="post">
<table>
<tr>
<td>Email Adress:</td>
<td>
<input type="text" name="email_address" value="" maxlength="100" />
</td>
</tr>
<tr>
<td>Comments:</td>
<td>
<textarea rows="10" cols="50" name="comments"></textarea>
</td>
</tr>
<tr><td> </td>
<td>
<input type="submit" value="Submit" />
</td>
</tr>
</table>
</form>
send_mail.php:
<?php
function isInjected($str) {
$injections = array('(\n+)',
'(\r+)',
'(\t+)',
'(%0A+)',
'(%0D+)',
'(%08+)',
'(%09+)'
);
$inject = join('|', $injections);
$inject = "/$inject/i";
if(preg_match($inject,$str)) {
return true;
}
else {
return false;
}
}
$email_address = $REQUEST['email_address'] ;
$comments = $REQUEST['comments'] ;
if (!isset($_REQUEST['email_address'])) {
header( "Location: 1.html" );
}
elseif (empty($email_address) || empty($comments)) {
header( "Location: error_message.html" );
}
elseif ( isInjected($email_address) ) {
header( "Location: error_message.html" );
}
else {
mail( "my@mail.com", "Feedback",
$comments, "From: $email_address" );
header( "Location: thank_you.html" );
}
?>
Thank You!