MyBB Community Forums

Full Version: How do i display some text correctly from database?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Helo Friends...
I Create a Comment Form.. its working fine but when someone enter long comment in a row without pressing enter then its display in same format and cross the my site's width...
I want to display it according to my site's width.
i m using <pre> tag, i also remove this tag but not works as i want.. Sad After Removing <pre> tag then its display according to my site's width but all text display in one row. for Example:-
I Enter this comment.
----------------------
|Hello. |
| My Name is Rahul |
| I am a Good Guy. |
---------------------

It will be print as like this without using <pre> tag
"Hello. My Name is Rahul I am a Good Guy"

So how do i solve this friends?
Thanks For Help me...
Also Tell me any site where can i discuss Programming Related Quetions..
Thanks!
If you input stuff via a textarea, run nl2br() on the text before outputting it.
(2013-02-17, 06:50 AM)Josh H. Wrote: [ -> ]If you input stuff via a textarea, run nl2br() on the text before outputting it.

Thanks!
The way I do it for Asperger's Network is running

(2013-02-17, 06:50 AM)Josh H. Wrote: [ -> ]nl2br()

As it is inserted into the DB, then

stripslashes()

on the way out (mysql_real_escape_string() is declared as a variable as I make them all variables on submit)
(2013-02-17, 08:41 AM)Ben Cousins Wrote: [ -> ]The way I do it for Asperger's Network is running

(2013-02-17, 06:50 AM)Josh H. Wrote: [ -> ]nl2br()

As it is inserted into the DB, then

stripslashes()

on the way out (mysql_real_escape_string() is declared as a variable as I make them all variables on submit)

Thanks, i will be try both. Let see what can i do?