Re-inserting newlines
| From: | Philip Thompson | Date: | Thu, 23 Jun 2005 16:23:52 +0000 |
| Subject: | Re-inserting newlines | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-217502@lists.php.net to get a copy of this message | ||
Hi all.
I have searched for a way to figure out this problem, but nothing is popping up. Here's the scenario:
I have a form which I will write to a database - so I escape the form content. I have a <textarea></textarea> in the form. Obviously, people can type whatever they want to in this textarea, including newlines. Ok, I know how to escape the content to put it in the database - but if there is an error on the page, I want to redirect back to the page and correct their stuff.
So they have in one of the textareas:
--- start here ---
This is a line in the text area.
This is a line a couple of lines down in the text area.
--- end here ---
If I print the stuff back out to screen, it reads:
--- start here ---
This is a line in the text area.\r\n\r\nThis is a line a couple of lines down in the text area.
--- end here ---
Anyone know how/what to replace the \r\n in the textarea to that it shows up correctly with the actual newlines, not the \r\n???
Thanks in advance,
~Philip