Before storing information from a form in database I perform follwing
operations on it :
$path =
mysql_real_esca pe_string(strip _tags(trim(urld ecode($_POST['path']))));
$summary =
mysql_real_esca pe_string(strip _tags(trim(urld ecode($_POST['summary']))))
When I look in database I see '\r\n' in the text for the summary
wherever I pressed return-key.
When i retrieve the information from database and display it on webpage
'\r\n' is displayed even when I use
nl2br or
str_replace("\r \n", "<br/>", $content) or
str_replace(arr ay("\r\n", "\n", "\r"), "<br>", $text) or
preg_replace("/\r\n|\n|\r/", "<br>", $text)
the '\r\n' is replaced with a <br>.
How is the possible ? The functions work when I let them handle a string
like "A little bit of\r\ntext".
A folder is stored as 'H:\\\\My Pictures\\\\Ane mone.jpg' in the
database. When I want to display the folder I use the function
stripslashes first but then I still get 'H:\\My Pictures\\Anemo ne.jpg'.
Why should I apply stripslashes twice ?
Hope you can help me,
JM!
operations on it :
$path =
mysql_real_esca pe_string(strip _tags(trim(urld ecode($_POST['path']))));
$summary =
mysql_real_esca pe_string(strip _tags(trim(urld ecode($_POST['summary']))))
When I look in database I see '\r\n' in the text for the summary
wherever I pressed return-key.
When i retrieve the information from database and display it on webpage
'\r\n' is displayed even when I use
nl2br or
str_replace("\r \n", "<br/>", $content) or
str_replace(arr ay("\r\n", "\n", "\r"), "<br>", $text) or
preg_replace("/\r\n|\n|\r/", "<br>", $text)
the '\r\n' is replaced with a <br>.
How is the possible ? The functions work when I let them handle a string
like "A little bit of\r\ntext".
A folder is stored as 'H:\\\\My Pictures\\\\Ane mone.jpg' in the
database. When I want to display the folder I use the function
stripslashes first but then I still get 'H:\\My Pictures\\Anemo ne.jpg'.
Why should I apply stripslashes twice ?
Hope you can help me,
JM!
Comment