c_pattle Posted December 31, 2010 Share Posted December 31, 2010 I have a form which has a textarea in it. When the form is submitted the contents are submitted to a MySQL database and the contents or the textarea are stored in a text variable. What is the best was to preserve line breaks in the textarea? At the moment if the user enters to separate paragraphs into the textarea they will be merged into one. Thanks for any help. Quote Link to comment https://forums.phpfreaks.com/topic/223096-phpmysql-preserve-line-breaks/ Share on other sites More sharing options...
PFMaBiSmAd Posted December 31, 2010 Share Posted December 31, 2010 New-line characters don't mean anything in rendered HTML that is displayed on a web page (unless you use <pre></pre> tags or similar around the content.). You need <br> or <br /> HTML tags. See this link - nl2br Quote Link to comment https://forums.phpfreaks.com/topic/223096-phpmysql-preserve-line-breaks/#findComment-1153418 Share on other sites More sharing options...
c_pattle Posted January 1, 2011 Author Share Posted January 1, 2011 Thanks Quote Link to comment https://forums.phpfreaks.com/topic/223096-phpmysql-preserve-line-breaks/#findComment-1153503 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.