Re: addslashes problem ..
| From: | Adrian Murphy | Date: | Fri, 06 Jul 2001 16:47:24 +0000 |
| Subject: | Re: addslashes problem .. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-56524@lists.php.net to get a copy of this message | ||
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" <cday@atpco.com>
To: <php-general@lists.php.net>
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: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>