Re: Special Characters in a String for Output

From: Date: Thu, 27 Aug 2009 14:44:19 +0000
Subject: Re: Special Characters in a String for Output
References: 1 2 3 4 5 6 7 8 9  Groups: php.general 
Request: Send a blank email to php-general+get-297371@lists.php.net to get a copy of this message
On Thu, Aug 27, 2009 at 9:56 AM, David Stoltz<Dstoltz@shh.org> wrote: > 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! > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > use htmlentities <?php echo htmlentities($goalString); ?> -- Bastien Cat, the other other white meat

« previous php.general (#297371) next »