HockeyDevil07 Posted September 12, 2008 Share Posted September 12, 2008 Hey everyone, I'm not sure if this is the right forum to post this in, but here it goes. I'm writing a web page with a simple message board for users to discuss a few topics. Everything works fine but when the message text is retrieved from MySQL and put back onto the page the return spaces aren't there. Here's what I mean: "This is the the message body. This is the second line. This is the third line." It shows up my MySQL database exactly as written up there, but when it is put onto the web page it'll show up like: "This is the message body. This is the second line. This is the third line." Obviously I want it to be displayed the way I intended it to be. I know why it's outputting it like that. I was wondering if anyone here could give me some hints on how to parse the message (not sure if that's really what I need to do) or if there are any simple fixes to this problem. Any links to information, tips, or suggestions are welcome. Thanks in advance for anyone's help! Quote Link to comment https://forums.phpfreaks.com/topic/123977-help-properly-formatting-text/ Share on other sites More sharing options...
Maq Posted September 12, 2008 Share Posted September 12, 2008 Could you provide the code that you put the data in? Quote Link to comment https://forums.phpfreaks.com/topic/123977-help-properly-formatting-text/#findComment-640034 Share on other sites More sharing options...
Mchl Posted September 12, 2008 Share Posted September 12, 2008 Use nl2br() php function to convert newlines to < br/> Quote Link to comment https://forums.phpfreaks.com/topic/123977-help-properly-formatting-text/#findComment-640041 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.