Re: Special Characters in a String for Output

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Aug 27, 2009 at 9:56 AM, David Stoltz<Dstoltz@xxxxxxx> 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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux