Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
parsing returns out of a string
Old 12-19-2005, 07:50 PM parsing returns out of a string
Novice Talker

Posts: 10
Trades: 0
I have a textarea that i get via $_POST in php. I want to replace the carriage returns in the string, but it won't work. I tried $var=str_replace("\n", "",$var); but it didn't work. Also, $var=str_replace("\n", "a",$var); will put an a in between the carriage returns, but it does not get rid of them. Any ideas?
benhorton2 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 12-20-2005, 08:36 AM
ibbo's Avatar
Super Spam Talker

Posts: 880
Location: Leeds UK
Trades: 0
try nl2br() or just swap \n with <br />

Ibbo
__________________

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Linux user #349545 :
(GNU/Linux)iD8DBQBAzWjX+MZAIjBWXGURAmflAKCntuBbuKCWenpm XoA7LNydllVQOwCf
ibbo is offline
Reply With Quote
View Public Profile Visit ibbo's homepage!
 
Old 12-20-2005, 07:36 PM
Novice Talker

Posts: 10
Trades: 0
It didn't work; it replaced the line break with <br /> but i'm writing them to a file and it kept the line breaks but printed <br /> in them.
Example:
test<br />
<br />
test
benhorton2 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to parsing returns out of a string
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.44454 seconds with 12 queries