webref.eu Posted August 16, 2008 Share Posted August 16, 2008 Hi All If I input this into my textarea on my form: This is the first paragraph. This is the second paragraph. This is the third paragraph. i.e. I have put some line breaks into my input, when I look at the input in MySQL Query Browser I can see two (line break?) characters between each line as shown graphically in my attachment. Presently, when I pull the text out from my database and display on page, then the line breaks are not being preserved. So, how do I get the line breaks to be recognised when I redisplay the text? Thanks all. [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/119976-preserving-paragraphs-from-form-input-to-database-to-on-page-display/ Share on other sites More sharing options...
webref.eu Posted August 16, 2008 Author Share Posted August 16, 2008 OK, so I've found the nl2br function, which works: nl2br($row[ReviewDesc]) is this the best practice method? Many thanks. Quote Link to comment https://forums.phpfreaks.com/topic/119976-preserving-paragraphs-from-form-input-to-database-to-on-page-display/#findComment-618036 Share on other sites More sharing options...
Barand Posted August 16, 2008 Share Posted August 16, 2008 It's certainly the easiest and most common. Quote Link to comment https://forums.phpfreaks.com/topic/119976-preserving-paragraphs-from-form-input-to-database-to-on-page-display/#findComment-618064 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.