replacing carriage returns?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • yawnmoth

    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>
  • jn

    #2
    Re: replacing carriage returns?

    "yawnmoth" <terra1024@yaho o.com> wrote in message
    news:c5t6qv8l81 jt4ofso3lecvgca 5ibhpgn9b@4ax.c om...[color=blue]
    > 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>
    >[/color]

    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']);



    Comment

    Working...