lebexpress Posted April 5, 2009 Share Posted April 5, 2009 Hello, I have a form in my website which allows me to type and submit a description of every item I list for sale. My html code is: Description<td><textarea name = "full_description" cols = "40" rows = "10" ></textarea><br> <tr><td> After I submit the description I insert in the text area into my table (called "products") , I try to display it, it displays it but wont display it in an organized way as I typed it with the break lines or paragraphs, instead, it shows a one line. For example: If I type in: * Car Cradle With FM Modulator * Remote Control * Mini-Micro Antenna * Power Adapter * Mounting Accessories * Install Guide and submit , click on the page that displays it, it shows: * Car Cradle With FM Modulator* Remote Control* Mini-Micro Antenna* Power Adapter* Mounting Accessories* Install Guide unless when I type it and before I submit the form I place <br> at the end of each line ex: * Car Cradle With FM Modulator <br> * Remote Control<br> etc<br> In the display page, let's say I use simple php code: $description_full = $row["description_full"]; echo" $description_full"; How can I get the line breaks to take effects automatically instead of typing them manually? Thank you! Quote Link to comment https://forums.phpfreaks.com/topic/152618-displaying-text-in-html-with-line-breaks-mysql-php/ Share on other sites More sharing options...
wildteen88 Posted April 5, 2009 Share Posted April 5, 2009 use n2br $description_full = $row["description_full"]; echo nl2br($description_full); Quote Link to comment https://forums.phpfreaks.com/topic/152618-displaying-text-in-html-with-line-breaks-mysql-php/#findComment-801691 Share on other sites More sharing options...
lebexpress Posted April 5, 2009 Author Share Posted April 5, 2009 Thanks for your reply. I tried using the function: n2br as you suggested, and I still get the same results. Any other suggestions? Thank you Quote Link to comment https://forums.phpfreaks.com/topic/152618-displaying-text-in-html-with-line-breaks-mysql-php/#findComment-801735 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.