Seeing Line Breaks?

This is a discussion on "Seeing Line Breaks?" within the PHP Forum section. This forum, and the thread "Seeing Line Breaks? are both part of the Program Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Feb 24th, 2008, 17:45
Jack Franklin's Avatar
Moderator

SuperMember
Join Date: May 2007
Location: Cornwall, England
Posts: 1,404
Blog Entries: 8
Thanks: 18
Thanked 14 Times in 14 Posts
Seeing Line Breaks?

When a comment is left on the blog, when someone hits enter they move down a line and type some more, but when the comment is saved to the database the line breaks are not preserved and kept, so when the comment is displayed it displays without a single line break, is there a way to solve this? Right now I have told people to use '<br />' but there must be a way!
__________________
Jack Franklin - Webforumz Moderator
(x)HTML | CSS | PHP | MySQL | JQuery (Javascript)
Contact: My Blog | Twitter | Delicious
Want Lessons? PM me.
If you think I've helped, please press the 'Thanks' Button.
Last Blog Entry: A Week with VBulletin (Aug 28th, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Feb 24th, 2008, 19:45
Jack Franklin's Avatar
Moderator

SuperMember
Join Date: May 2007
Location: Cornwall, England
Posts: 1,404
Blog Entries: 8
Thanks: 18
Thanked 14 Times in 14 Posts
Re: Seeing Line Breaks?

Fixed it myself in the end using nl2br($string);
Read: http://www.plus2net.com/php_tutorial/line-breaks.php
__________________
Jack Franklin - Webforumz Moderator
(x)HTML | CSS | PHP | MySQL | JQuery (Javascript)
Contact: My Blog | Twitter | Delicious
Want Lessons? PM me.
If you think I've helped, please press the 'Thanks' Button.
Last Blog Entry: A Week with VBulletin (Aug 28th, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Feb 24th, 2008, 20:55
CloudedVision's Avatar
Moderator
Join Date: Feb 2008
Location: In My Own Little World
Age: 14
Posts: 1,255
Blog Entries: 9
Thanks: 2
Thanked 40 Times in 40 Posts
Re: Seeing Line Breaks?

That inserts <br>, but if your using XHTML you'll want <br />

I would use str_replace
__________________
Web Design And Development: Other Road Design | Problems with IE6?: KApp | My Blog: Only Nerds Allowed | Learning PHP? Lessons
Last Blog Entry: Hilarious Rapper (Jul 29th, 2008)

Last edited by CloudedVision; Feb 24th, 2008 at 20:59.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Big Breaks jtyoungs Web Page Design 11 Dec 7th, 2007 10:59
Line breaks alexgeek Other Programming Languages 1 Nov 1st, 2007 01:51
retrieving and displaying line breaks nate2099 Databases 1 Jul 13th, 2007 08:56
eref, textarea, line breaks ppgpilot PHP Forum 2 Jan 20th, 2007 18:13
Adding RETURN line breaks to a database Lizard- Classic ASP 2 Aug 19th, 2004 09:49


All times are GMT. The time now is 02:18.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42