line breaks pulled from the database

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
rsmarsha
Forum Contributor
Posts: 242
Joined: Tue Feb 08, 2005 4:06 am
Location: Leeds, England

line breaks pulled from the database

Post by rsmarsha »

I am building a mailing list setup and am having a small problem.

If i input

line 1
line 2

into a text area it inputs into the database fine. When i edit the message in the test area it shows as 2 lines, and in the mail thats sent it also shows as 2 lines.

When i pull the information from the database to display into a table showing all the lists, it doesn't show the line break. Any idea why this happens and could you point me in the right direction to fix it?
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Post by Jenk »

browsers don't render line breaks as line breaks, if you view source they will be there..

nl2br() to the rescue.
Post Reply