Welcome Guest, Not a member yet? Register   Sign In
maintaining line breaks from a textbox input
#1

[eluser]richzilla[/eluser]
Hi all. Is there anyway to maintain the general layout of the text in a text box, when it is displayed on the page again? as an example, a user enters several paragraphs of text in a textbox, presses submit, and the text is saved in the database, when the text is retrieved again, its been turned into one long string? basically i want it to look the same coming out of the db as it did going in.

Any help would be appreciated.

Thanks
#2

[eluser]Dam1an[/eluser]
Take a look at the PHP function nl2br
#3

[eluser]Johan André[/eluser]
I would use the typography-helper in your case.
Save the "raw" content of your textarea to db, then output it with auto_typography($content) to automatically format it with br, p and other goodness!

It's actually like a nl2br on speed! Smile
#4

[eluser]Dam1an[/eluser]
Good point Johan, I completely forgot about auto_typography, must remember that in the future Smile




Theme © iAndrew 2016 - Forum software by © MyBB