How to preserve line breaks in the database on user submitted text?

Posted by Crashalot on Stack Overflow See other posts from Stack Overflow or by Crashalot
Published on 2010-03-26T02:03:28Z Indexed on 2010/03/26 2:13 UTC
Read the original article Hit count: 439

Filed under:
|

Users enter text through a text area element, much like we enter questions on StackOverflow.

What's the best way to preserve the line spacing in the database so that it can be reproduced on the front end? The idea is the text should appear with the same line breaks and blank lines as entered originally by the user.

© Stack Overflow or respective owner

Related posts about forms

Related posts about webforms