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.



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

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Feb 24th, 2008, 17:45
Jack Franklin's Avatar
Resources Administrator

SuperMember
Join Date: May 2007
Location: Cornwall, England
Posts: 1,268
Blog Entries: 7
Thanks: 10
Thanked 4 Times in 4 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!
Last Blog Entry: My Latest Project - Grilling Gurus... (Jun 11th, 2008)
Reply With Quote

  #2 (permalink)  
Old Feb 24th, 2008, 19:45
Jack Franklin's Avatar
Resources Administrator

SuperMember
Join Date: May 2007
Location: Cornwall, England
Posts: 1,268
Blog Entries: 7
Thanks: 10
Thanked 4 Times in 4 Posts
Re: Seeing Line Breaks?

Fixed it myself in the end using nl2br($string);
Read: http://www.plus2net.com/php_tutorial/line-breaks.php
Last Blog Entry: My Latest Project - Grilling Gurus... (Jun 11th, 2008)
Reply With Quote
  #3 (permalink)  
Old Feb 24th, 2008, 20:55
CloudedVision's Avatar
Nerdy Moderator
Join Date: Feb 2008
Location: In My Own Little World
Age: 14
Posts: 942
Blog Entries: 8
Thanks: 2
Thanked 22 Times in 22 Posts
Send a message via AIM to CloudedVision Send a message via MSN to CloudedVision Send a message via Skype™ to CloudedVision
Re: Seeing Line Breaks?

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

I would use str_replace
__________________
echo "Take it easy, ".$CloudedVision;
.links { site: other-road-design; blog: only-nerds-allowed; project: resource-fish; organization: ARMIES6; }
<quote>&quot;I think it's wrong that only one company makes the game Monopoly&quot; - <name>Steven Wright</name></quote>
Last Blog Entry: More Cheat Sheets (Jul 12th, 2008)

Last edited by CloudedVision; Feb 24th, 2008 at 20:59.
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 06:01.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs 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 43