homepage Welcome to WebmasterWorld Guest from 54.166.159.110
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
creating <br /> from textarea
whatson

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 4512822 posted 9:01 pm on Oct 26, 2012 (gmt 0)

If I have a textarea and a complete the form like:

99 Main Street
Springfield
New York

And I store it in the database.
When I pull it into a variable to be echoed, how do I create the <br />'s i.e. to stop it looking like:

99 Main Street Springfield New York

is it something to do with /n?

 

lucy24

WebmasterWorld Senior Member lucy24 us a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



 
Msg#: 4512822 posted 10:13 pm on Oct 26, 2012 (gmt 0)

Can't you just echo the <br /> itself? Add it to the end of each string. (Or possibly "<br \/>". I forget.)

:: detour to random page to confirm that that's what I did in recently created navigation footer ::

The difference between \n and and <br> is the same as in ordinary raw html: one affects what you see in the code. The other affects what the user sees.

coopster

WebmasterWorld Administrator coopster us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4512822 posted 10:18 pm on Oct 26, 2012 (gmt 0)

You can use the nl2br function:
[php.net...]

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved