Forum Moderators: coopster

Message Too Old, No Replies

Form Input and Display - Line breaks

How to get line breaks in display

         

mvaz

10:52 am on Jul 5, 2008 (gmt 0)

10+ Year Member



Hello, I have a form on my website that contains a input field for messages and other information to be input. This input is stored in mysql database. However, if a user has a line break in the form, I cannot get the content in the second paragraph when this information is displayed on the browser. Is it possible to get the contents in paragraphs as the user intends?

I have tried this myself with a <br> in the input field and this displays perfectly, but I cannot ask the general users to type the line break attribute when inputting a form.

Any help and suggestions that you esteemed members and administrators provide would be invaluable and I thank you all in advance for your assistance in helping me get this sorted out.

henry0

11:27 am on Jul 5, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



to output the <br> you need to use
nl2br [php.net]
ex: your content is $content, usage: nl2br($content);

mvaz

7:58 pm on Jul 6, 2008 (gmt 0)

10+ Year Member



Thanks a lot henry0, you have been a great help. It works great now. Once again, thank you to all the experts on here who provide continuous support and assistance to all learners.