Forum Post New Line

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
User avatar
lenton
Forum Commoner
Posts: 49
Joined: Sun Jun 20, 2010 6:45 am

Forum Post New Line

Post by lenton »

I'm currently making my own forum in PHP.

I have this in my database:
Image

But when I echo it on my forum it doesn't show the new lines:
Image

How do I get the post to echo the same as what's in the database (with the line breaks). Thanks for your help!
User avatar
Darhazer
DevNet Resident
Posts: 1011
Joined: Thu May 14, 2009 3:00 pm
Location: HellCity, Bulgaria

Re: Forum Post New Line

Post by Darhazer »

use nl2br() ;) This will replace new lines with <br/> tags which is the way to display a new line in HTML page
User avatar
lenton
Forum Commoner
Posts: 49
Joined: Sun Jun 20, 2010 6:45 am

Re: Forum Post New Line

Post by lenton »

THANKS!
User avatar
ganesh_dabhade
Forum Newbie
Posts: 19
Joined: Sun Feb 06, 2011 12:42 am
Contact:

Re: Forum Post New Line

Post by ganesh_dabhade »

You have to use nl2br() function.
Post Reply