Jump to content

[SOLVED] I need help with a textarea


kevincro

Recommended Posts

I have a form that contains a textarea, the form is processed using php and is saved into a MySQL database field.  The DB field is a text area.  The problem that I have is no matter how the user enters the info, it is saved without any paragraphs or line breaks.  How do I over come this.  Thank you

KC

Link to comment
https://forums.phpfreaks.com/topic/80012-solved-i-need-help-with-a-textarea/
Share on other sites

No, when a user enters data into a textarea, linebreaks are transmitted as the "\n" characters. When this data is displayed in a browser, the browser does not interpret the "\n" to be a line break, so you need to use the nl2br() function to add the <br> tag after each "\n" character.

 

Ken

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.