display user input without \n\r
I use functions (check(removeTags($data))) to save the text in mysql
database:
function check($data){
if (get_magic_quotes_gpc()) {
$data = stripslashes($data);
}
$data =addcslashes( mysql_real_escape_string($data) , "%_" );
return $data;
}
function removeTags($data){
$data=trim($data);
$data=strip_tags($data);
return $data;
}
I use this function to display text above was saved to the user.
function output($data){
return htmlspecialchars($data,ENT_QUOTES,"UTF-8");
}
But Unwanted character are added to the text.replace newline('<br/>') with
"\n\r".
I use stripslashes but it didn't worked ( replace '\n\r' with 'nr' ).
I use str_replace("\\r\\n", "\r\n",$data) but it didn't worked too.
how can i remove '\n\r' ?
No comments:
Post a Comment