Page 1 of 1

Line Breaks in a Form

Posted: Sun Aug 05, 2007 2:20 pm
by the9ulaire
I have an HTML form that puts data into my MySQL database, if you add line breaks in the form it is retained in the database, but if you try to display the data it is one long string, naturally. How do I make it so that the line breaks are interpreted to "<br />"s? What would be an efficient way of creating breaks?

I currently have this:

Code: Select all

<textarea class="body" name="page_content" rows="10" cols="60"><?php echo htmlspecialchars($page_content); ?></textarea>
Thank you, in advance, for you time! It's greatly appreciated!
Luke

Posted: Sun Aug 05, 2007 2:37 pm
by John Cartwright
nl2br() is your friend

Posted: Sun Aug 05, 2007 4:38 pm
by the9ulaire
Thank you so much! Everything is working great!