473,406 Members | 2,343 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

cant replace \n

Hi Folk

I am getting some data from an html form (textarea). I am having trouble
with replacing line breaks in the data with spaces.

here is my line:

trim(stripslashes(str_replace("\n", ' ',
(htmlentities($_POST["facexp"]))))));

I end up with lots of   but the linebreaks are still there.

What am I doing wrong?

Thank you

- Nicolaas
Jul 17 '05 #1
2 4389
windandwaves wrote:
I am getting some data from an html form (textarea). I am having
trouble with replacing line breaks in the data with spaces.

here is my line:

trim(stripslashes(str_replace("\n", ' ',
(htmlentities($_POST["facexp"]))))));

I end up with lots of   but the linebreaks are still there.

What am I doing wrong?


IIRC line breaks from an html textarea are supposed to be done with \r\n
so you'd want to str_replace("\r\n\", '&nbsp', ...

--
Chris Hope | www.electrictoolbox.com | www.linuxcdmall.com
Jul 17 '05 #2
Chris Hope wrote:
windandwaves wrote:
I am getting some data from an html form (textarea). I am having
trouble with replacing line breaks in the data with spaces.

here is my line:

trim(stripslashes(str_replace("\n", ' ',
(htmlentities($_POST["facexp"]))))));

I end up with lots of   but the linebreaks are still there.

What am I doing wrong?


IIRC line breaks from an html textarea are supposed to be done with
\r\n so you'd want to str_replace("\r\n\", '&nbsp', ...


Thank you.
Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: chuck amadi | last post by:
By the way list is there a better way than using the readlines() to > > >parse the mail data into a file , because Im using > > >email.message_from_file it returns > > >all the data i.e reads one...
1
by: Dave | last post by:
We have a brand new sql 2k server. Its all up to date on service packs (both win2k and SQL). I went in to enterprise manager and added a new db. I can run sprocs and raw sql against the new db...
10
by: Ragnar Heil | last post by:
Hi, I am receiving news from a press-agency in NITF-XML. Then I want to import them into my CMS using XML&SOAP. The import-tool runs fine if I have got an xml-document with real German special...
3
by: Andy | last post by:
Hi, i tried to load an assembly to an appdomain. The data output is correctly but the assembly is still in use after unloading the appdomain... What am I doing wrong? Please help! My...
1
by: shruds | last post by:
i have the following code in a .jsp file: <script language="JavaScript"> function TAB_LOADER() { this.functions = new Array(); this.add = function(funct) { this.functions = funct; }...
3
by: Jason | last post by:
Hello, I am writting a media compressor in Visual C++. I am trying to use the ICCCompressor functions already in the libraries. The problem is that no codec are showing up in the dialog box. ...
4
by: Beemer Biker | last post by:
I am adding at bindtime an htmlbutton and an html dropdownlist. The idea is to select the item in the list, hit the button and my callback code uses the ID.selectedindex to act on the item that...
5
by: lazzypink | last post by:
query = "UPDATE Camera SET CameraName=" + CameraName + " WHERE CameraName=" + oldIPCamera.CameraName; hi guys! can help me solve this problem? why i cant update the new camera name (camera_3) for...
4
by: MeDontGetSomething | last post by:
Hi What is the easiest way to format c drive from usb drive without using XP instalation disk. That was the shor story, this the long one if someone cares to read:) See, the situation...
2
prabirchoudhury
by: prabirchoudhury | last post by:
hey all i am having problem with NULL values to replace with, i have been using all the way to replace NULL value but non of those working for me. NOT NULL field is replacing with abut not the NULL...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.