Current location: Hot Scripts Forums » Programming Languages » PHP » PHP replies


PHP replies

Reply
  #1 (permalink)  
Old 11-17-09, 04:34 PM
SniperTowers SniperTowers is offline
Wannabe Coder
 
Join Date: Dec 2008
Posts: 143
Thanks: 5
Thanked 0 Times in 0 Posts
PHP replies

I'm currently building a site which requires users to post replies.

I would like it so it takes note of the line breaks that the user has posted.

Eg. When some posts this:
Code:
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec vel dolor metus. 

Aenean consectetur, magna sit amet volutpat fermentum, eros magna tincidunt est, et ultricies ipsum turpis in sem. 

Nunc blandit, diam dictum bibendum dapibus, ligula nisl porttitor est, non feugiat enim neque eu sem.
It'll go in the database like this:

Code:
Lorem ipsum dolor sit amet, consectetur 
adipiscing elit. Donec vel dolor metus.
 Aenean consectetur, magna sit amet 
volutpat fermentum, eros magna 
tincidunt est, et ultricies ipsum turpis in 
sem. Nunc blandit, diam dictum bibendum 
dapibus, ligula nisl porttitor est, non feugiat 
enim neque eu sem.
So when I try to return it like this:
PHP Code:

$row['content']; 

It'll show like it is in the database. How can I get it to take note of the line breaks?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 11-17-09, 04:48 PM
The Knowing The Knowing is offline
Newbie Coder
 
Join Date: Nov 2009
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
What is the code you are using to submit the information to the database? When a user puts the information in, is he/she putting in the html <br/> or is it done by just hitting the enter bar?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 11-17-09, 05:19 PM
SniperTowers SniperTowers is offline
Wannabe Coder
 
Join Date: Dec 2008
Posts: 143
Thanks: 5
Thanked 0 Times in 0 Posts
The user is just hitting the space bar.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 11-17-09, 08:21 PM
The Knowing The Knowing is offline
Newbie Coder
 
Join Date: Nov 2009
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Did you mean the enter bar? Space bar shouldn't make a <br/>.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #5 (permalink)  
Old 11-17-09, 08:29 PM
SniperTowers SniperTowers is offline
Wannabe Coder
 
Join Date: Dec 2008
Posts: 143
Thanks: 5
Thanked 0 Times in 0 Posts
Oops, Yes enter bar. Sorry.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #6 (permalink)  
Old 11-17-09, 11:41 PM
End User's Avatar
End User End User is offline
Level II Curmudgeon
 
Join Date: Dec 2004
Posts: 3,027
Thanks: 14
Thanked 35 Times in 33 Posts
Quote:
Originally Posted by SniperTowers View Post
It'll show like it is in the database. How can I get it to take note of
the line breaks?
Take a look at nl2br()
__________________
I don't live on the edge, but sometimes I go there to visit.
-------------------------------------------------------------------------
Sanitize Your Data | Oracle Date & Substring Functions | Code Snippet Library | [url=http://www.codmb.com/Call Of Duty[/url]
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
2 profitable script sites for sale cms-master.com General Advertisements 3 07-03-07 11:17 AM
help with error messages.. please APuppyDog PHP 2 10-06-06 12:09 AM
PHP Downside--Solutions? Amulet PHP 10 07-15-05 09:26 AM


All times are GMT -5. The time now is 09:32 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.