By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,037 Members | 962 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,037 IT Pros & Developers. It's quick & easy.

replacing carriage returns?

P: n/a
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("%0D%0A","...",$_GET['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
Share this Question
Share on Google+
1 Reply


P: n/a
jn
"yawnmoth" <te*******@yahoo.com> wrote in message
news:c5********************************@4ax.com...
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("%0D%0A","...",$_GET['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","...",$_GET['text']);

Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.