I have an HTML form that sends a contact mail with PHP.
Everything goes well except for the body of the message that comes from a textarea, which will be filtered with both these functions:
1: mysql_real_escape_string()
OR
2:
function clean_data($input) {
$input = trim(htmlentities(strip_tags($input,",")));
if (get_magic_quotes_gpc())
$input = stripslashes($input);
$input = mysql_real_escape_string($input);
return $input;
}
when I put some line breaks, it converts to real visible
Instead of showing this:
Hello,
This is a test mail.
It shows this:
Hello, This is a test mail.
If I pass the string as is without validation it works well.
Whats the problem here?
Thanks.