Possible Duplicate:
Correctly encode characters in a PHP mail form (“I'm” turns to be “I\'m”)
I’m sending an email over PHP and the text arrives with a slash right before the quotation mark:
I'm becomes I\'m
My PHP:
$text_message = $_POST["mymessage"];
$message="--PHP-mixed-$bound_text\r\n"
."Content-Type: text/plain; charset=\"utf-8\"\r\n"
."Content-Transfer-Encoding: 7bit\r\n\r\n"
."$text_message\r\n\r\n"
."--PHP-mixed-$bound_text\r\n"
."Content-Transfer-Encoding: base64\r\n"
."Content-Disposition: attachment; filename=\"$attachment\"\r\n"
."Content-Type: image/jpeg; name=\"$attachment\"\r\n\r\n"
.chunk_split($file)
."\r\n\r\n"
."--PHP-mixed-$bound_text--\r\n\r\n";
}
How to get it send without receiving an extra slash?
Thanks.
Uli
This is caused by PHP’s magic quotes which are deprecated but, unfortunately, still enabled by default. In most cases you can disable the feature through a
.htaccessfile or even through the webhoster’s control panel.If that’s not possible, it’s safest to check if magic quotes are enabled through
get_magic_quotes_gpc()before blindly usingstripslashes(). To unescape all$_POST[]variables, use: