473,809 Members | 2,740 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

replacing carriage returns?

so... i'm trying to remove all carriage returns in the input i get
from GET, and am trying to replace them with three dots...

however, this never seems to work... i'm still getting carriage
returns...

here's my script... any ideas as to what's wrong?:

<?php

$asdf = str_replace("%0 D%0A","...",$_G ET['text']);
print $asdf;

?>
<form method="GET" action="atest02 .php">
<textarea rows="7" name="text" cols="29"></textarea>
<input type="submit" value="Submit">
<input type="reset" value="Reset">
</form><p>
Jul 17 '05 #1
1 13041
jn
"yawnmoth" <te*******@yaho o.com> wrote in message
news:c5******** *************** *********@4ax.c om...
so... i'm trying to remove all carriage returns in the input i get
from GET, and am trying to replace them with three dots...

however, this never seems to work... i'm still getting carriage
returns...

here's my script... any ideas as to what's wrong?:

<?php

$asdf = str_replace("%0 D%0A","...",$_G ET['text']);
print $asdf;

?>
<form method="GET" action="atest02 .php">
<textarea rows="7" name="text" cols="29"></textarea>
<input type="submit" value="Submit">
<input type="reset" value="Reset">
</form><p>


Instead of the character codes, use escape sequences. Carriage Return is \r
and New Line is \n.

Something like this:
$asdf = str_replace("\r ","...",$_G ET['text']);

Jul 17 '05 #2

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

Similar topics

2
1790
by: Jerome | last post by:
Hi, I know this is an old question but I don't find the solution on the 'net ... The user enters his data into a multiline textarea field. The data is saved in a TEXT field in a database on a SQL Server. I want to display that data now, but the carriage returns should be replaced with <br>! Otherwise the text doesn't have paragraphs. How do I do that?
4
7325
by: Les Juby | last post by:
Can someone please help with a suggestion as to how I can keep the formatting (carriage returns) that the user enters into a memo field and then display that later. I figured I might be able to use: 'replace carriage returns with BRs comment=Replace(comment, chr(13), "<br>") but obviously net.! The <pre> tag doesn't sem to help either as the embedded return is
6
2295
by: Lewis Edward Moten III | last post by:
I'm having some problems when debugging datasets in C#. During run-time, I arrive at a break point in my code and goto the command window. I type MyDataset.GetXML() The results are a lot of text with \r\n in it and is very hard to read. I have to keep scrolling left and right as the text does not wrap either. When doing the same thing in VB, it writes out actually carriage returns so that each item appears on a new line. Is there a...
6
2040
by: Tbone | last post by:
I'm changing our order confimation from a plain text to HTML. The original setup of this had carriage returns between line items. These are not interpreted by HTML so all the line items run together. Here is the code that produces the body of the message. msg.Body = string.Format(body, values); return msg; Is there a method of Format to allow this kind of search and replace or
5
5136
by: Mario Vargas | last post by:
How do I replace carriage returns with <br /> in Visual Basic .NET? I know this is easy to do with C# by simply calling myNewString = myString.Replace( "\n", "<br />" ); Thank you for your input! Mario Vargas
2
2340
by: Matt Mercer | last post by:
Hi all, I am having a frustration problem, and I have read about 25 newsgroup postings that do not have a satisfying answer :) The problem appears to be common where carriage returns are lost when pulling data from an SQL database. The thing that frustrates me the most, is that when I use Enterprise Manager, the carriage returns ARE THERE. It looks fine until I pull it out.
1
2431
by: st | last post by:
Hi, I've a routine that exports a DB query to Excel by building an XmlDocument and saving to a XmlTextWriter. I'm having trouble with carriage returns in a mailing address not showing up in the final Excel sheet. What's added to the InnerText of an XmlDocument is something similar to:
7
11211
by: mattrapoport | last post by:
I have a page with a div on it. The div displays a user comment. When the user logs into this page, their current comment is pulled from a db and displayed in the div. The user can edit the comment through a pop-up that contains a textarea. When the user hits OK on the pop-up, the text in the textarea is sent to a function on the main page. The function inserts the text into the div's text node. Please don't ask why I'm making this...
0
1555
by: markus.shure | last post by:
Hi, I'm noticed a problem testing a JAX-WS client with a WSE server. The JAX-WS client adds carriage returns to a SOAP header element that is signed. This causes the WSE server to raise an error: "The signature or decryption failed". If the carriage returns are removed, the same web service call is successful. I tried replicating the situation with a WSE client. I created a WSE client that adds a SOAP header element that contains a...
0
9721
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9602
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10376
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10383
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10120
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5688
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4332
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3861
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.