tags:

views:

414

answers:

2

Every time I try, it makes removes the line breaks.

+1  A: 

When displaying the content you need to convert line breaks into <br /> tags, otherwise the web browser won't display them. This is probably why you think they aren't being saved. If you're using PHP, use the nl2br() function to do this. In other languages you could do a string replace, replacing all occurrences of "\n" with "<br />".

yjerem
You should clarify that you mean "when displaying content *outside of* a <textarea>". Within a textarea the browser displays literal "<br>"s.
Tomalak
A: 

I know from experience that Browser text areas are less well-behaved than one would like, especially with regard to line breaks.

You could can to see if javascript would be able to interrogate the text area and find the line breaks before the text is sent to the server and so send the data in a more well-formatted way. But the amount of javascript debugging necessary to make this work across multiple browsers is probably not worth the effort.

Perhaps you should say that format you are trying to capture your data. There may be a better way to get the data than keeping track of line-breaks - though lines breaks can seem like any easy thing to capture in user input.

Joe Soul-bringer