maybe i don't undestand correctly but try:
$string = str_replace("<br>","\\n",$string);

i.e escape the escape character  \\n

----- Original Message -----
From: "Chad Day" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, July 06, 2001 4:38 PM
Subject: [PHP] addslashes problem ..


> I have to use addslashes on a string of mine so I can use it in a
javascript
> function, so that when a link is clicked, a html textarea box is populated
> with that string.
>
> The problem I have is that if there are line breaks in the string, the
> <br>'s seem to get created when addslashes is run on the string, then in
the
> textarea box my string looks like:
>
> i can't do that<br>right now<br>but maybe later<br>
>
> How can I get the slashes escaped properly, but keep the same format?  I
> tried this:
>
> $RESPONSE = eregi_replace('<br[[:space:]]*/?[[:space:]]*>', "\n",
> $RESPONSE);
>
> but it didn't work for me, it just kinda merged all the strings together,
no
> line breaks (or <br>'s) at all.
>
> Thanks,
> Chad
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to