addslashes problem ..
| From: | Chad Day | Date: | Fri, 06 Jul 2001 15:38:18 +0000 |
| Subject: | addslashes problem .. | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-56512@lists.php.net to get a copy of this message | ||
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