NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page PHP help.

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 12-22-2005, 01:19 AM THREAD STARTER               #1 (permalink)
NamePros Regular
 
TwiztedFake's Avatar
Join Date: Apr 2004
Location: IL
Posts: 348
TwiztedFake is on a distinguished road
 



PHP help.


How do I insert line breaks into a text area form input when a users hits the enter to start a new line.

The form is submited via PHP to be stored in a database. Everything works fine just needing to know how to insert the line breaks.
__________________
-TwiztedFake-
RTard Tutorials
Digital-Dummy to Total-Techie
TwiztedFake is offline  
Old 12-22-2005, 02:52 AM   #2 (permalink)
NamePros Regular
Join Date: Oct 2005
Posts: 231
Immersion is an unknown quantity at this point
 



cant you do '/n' or something
Immersion is offline  
Old 12-22-2005, 05:22 AM   #3 (permalink)
Domains my Dominion
 
sdsinc's Avatar
Join Date: Aug 2005
Location: Web 1.0
Posts: 9,552
sdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatness
 


Third World Education Find Marrow Donors! Find Marrow Donors! Find Marrow Donors! Find Marrow Donors! Animal Rescue Animal Cruelty AIDS/HIV Animal Rescue Wildlife Breast Cancer Animal Rescue Wildlife
\r\n
__________________
NameNewsletter.com - free lists of available domain names
ZoneFiles.net (beta) - ccTLD and gTLD droplists
sdsinc is offline  
Old 12-22-2005, 08:41 AM   #4 (permalink)
NamePros Member
Join Date: Nov 2005
Posts: 126
cx409 is an unknown quantity at this point
 



If you're talking how to show 'Enters' submitted by a form into pure HTML, use the php function nl2br:
????: NamePros.com http://www.namepros.com/programming/150269-php-help.html

PHP Code:
$str $user_submitted_thing_with_line_breaks;
$new_str nl2br($str); 
It will make all line breaks into <br />'s
cx409 is offline  
Old 12-22-2005, 08:42 AM   #5 (permalink)
NamePros Expert
 
Peter's Avatar
Join Date: Nov 2003
Location: Scotland
Posts: 5,069
Peter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond repute
 


Child Abuse Save The Children Save The Children Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009
presumably you are having problems of the text only showing on 1 line when you rtetrieve it back from the database.

If that is the case run the variable through nl2br(). This changes the new line char to the <br> which html needs.
Peter is offline  
Old 12-22-2005, 10:33 AM   #6 (permalink)
Eating Pie
 
iNod's Avatar
Join Date: Nov 2004
Location: Canada
Posts: 2,272
iNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud of
 


Special Olympics AIDS/HIV Cystic Fibrosis Save The Children Baby Health Cystic Fibrosis
It depends what you want to do with the results from the textarea. If you wish to display it as text either nl2br or wordwrap will work. If you wish to store it in mysql db I would probley use nl2br. If you don't need to do anything but store it to be used in another textarea nothing is needed.

iNod.
__________________
I feel old.
iNod is offline  
Old 12-22-2005, 10:49 AM THREAD STARTER               #7 (permalink)
NamePros Regular
 
TwiztedFake's Avatar
Join Date: Apr 2004
Location: IL
Posts: 348
TwiztedFake is on a distinguished road
 



Thanks everyone I used nl2br() and it works just how I wanted. I store the information in the database then it is displayed on a page at a later time.

I gave everyone 10 np's for helping.
__________________
-TwiztedFake-
RTard Tutorials
Digital-Dummy to Total-Techie
TwiztedFake is offline  
Closed Thread


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Tutorial: Getting started with PHP (The Basics) deadserious Webmaster Tutorials 60 11-17-2007 12:35 PM
Great Scripts for Sale With Resale Rights! Zeeble Scripts For Sale 20 01-04-2006 02:39 AM
Googlism - What does google think of you? deadserious The Break Room 55 12-15-2005 10:09 AM

Liquid Web Smart Servers  
All times are GMT -7. The time now is 05:46 AM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger