Special Characters in a String for Output
| From: | David Stoltz | Date: | Thu, 27 Aug 2009 13:56:03 +0000 |
| Subject: | Special Characters in a String for Output | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-297369@lists.php.net to get a copy of this message | ||
I have:
$goalString = "<p align=left>Goals Entered By
".$mymanager."</p><p>On
".$when.":</p><p align=left>".$mygoal."</p>";
Which outputs in this <A> tag:
<a href="#" onmouseover="applyDMXTooltip(this,'<?php echo $goalString;
?>','normal','linear','mouse','out',1,1,'mouseout','yellow',false,'','',
0,0,'auto','auto','auto','auto')">....
But if there are double or single quotes in any of the $goalString, it
messes up the output.
I know this is a simple fix, but I'm not sure how to fix it since I'm
new to PHP...
I've tried addslashes, etc - but can't get it to work right...
Is there an easy way to escape ALL special characters that would cause
this output to fail?
Thanks!