note 20325 added to function.addslashes
| From: | guy_AT_datalink_DOT_net_DOT_au at php2 dot chek dot com | Date: | Sat, 30 Mar 2002 06:58:13 +0000 |
| Subject: | note 20325 added to function.addslashes | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-28405@lists.php.net to get a copy of this message | ||
If you're trying to escape quotes in a javascript event as such:
<img src="foo.gif" OnMouseOver="alert('<? print $myString
?>')">
It helps to perform this first:
$myString = str_replace("'", "\'", $myString);
$myString = str_replace('"', "'+String.fromCharCode(34)+'",
$myString);
--
http://www.php.net/manual/en/function.addslashes.php
http://master.php.net/manage/user-notes.php?action=edit+20325
http://master.php.net/manage/user-notes.php?action=delete+20325
http://master.php.net/manage/user-notes.php?action=reject+20325