note 44772 added to function.addslashes

From: Date: Mon, 16 Aug 2004 06:18:27 +0000
Subject: note 44772 added to function.addslashes
Groups: php.notes 
Request: Send a blank email to php-notes+get-79862@lists.php.net to get a copy of this message
I want to suggest something about this quote ============== guy_AT_datalink_DOT_net_DOT_au 30-Mar-2002 01:58 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); ============== I've used only addslashes(htmlentities($myString)), it worked fine on both alert and confirm javascript functions. exemple: onClick="return (confirm('do this :\n<?=addslashes(htmlentities($myString))?> ?'))" ---- Manual Page -- http://www.php.net/manual/en/function.addslashes.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+44772 Delete -- http://master.php.net/manage/user-notes.php?action=delete+44772&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+44772&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#79862) next »