Page 1 of 1

Html Wordwrap issue for mysql db!

Posted: Fri May 06, 2011 6:16 pm
by cap2cap10
Greetings again, members of the php technorati. How do I get form data to be saved in db with line breaks? I used wordwrap= virtual but it doesn't work! all lines are connected to each other in one continuous string! This is probably a noob issue but please enlighten me! I refuse to ask the user to add in <br> and <p>! Help me to help them make their form usage less complicated!

Thanks in advance,

Batoe

Re: Html Wordwrap issue for mysql db!

Posted: Fri May 06, 2011 7:49 pm
by requinix
Use nl2br when you display the text. Not when you put it into the database.
Because it already has the line breaks. The issue is that HTML will automatically collapse spaces and line breaks into a single space (unless told otherwise with the white-space CSS... thing).

Re: Html Wordwrap issue for mysql db!

Posted: Sat May 07, 2011 7:10 am
by oscardog
cap2cap10 wrote:Greetings again, members of the php technorati. How do I get form data to be saved in db with line breaks? I used wordwrap= virtual but it doesn't work! all lines are connected to each other in one continuous string! This is probably a noob issue but please enlighten me! I refuse to ask the user to add in <br> and <p>! Help me to help them make their form usage less complicated!

Thanks in advance,

Batoe
Alternatively, you can use a free WYSIWYG editor like TinyMCE or my personal favourite; CKEditor. This will automatically format in the paragraph tags etc.