note 20325 deleted from function.addslashes by cmb
| From: | cmb@php.net | Date: | Sun, 18 Oct 2020 11:03:15 +0000 |
| Subject: | note 20325 deleted from function.addslashes by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-215612@lists.php.net to get a copy of this message | ||
Note Submitter: guy_AT_datalink_DOT_net_DOT_au
----
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);