Jump to content

Problem with text format pulling from mysql field


stone140

Recommended Posts

If the user posted/entered the text (like a comment or so) using a <textarea> on your page the linebreaks will disappear if you just insert $_POST['text'] into your mysql-database. Instead you should insert nl2br($_POST['text']). This will preserve the linebreaks...
[quote author=Wuhtzu link=topic=111335.msg451113#msg451113 date=1160684713]
If the user posted/entered the text (like a comment or so) using a <textarea> on your page the linebreaks will disappear if you just insert $_POST['text'] into your mysql-database. Instead you should insert nl2br($_POST['text']). This will preserve the linebreaks...
[/quote]

It is much better practice to use nl2br() when outputting data

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.