In my php script I am echo-ing some javascript. I would like to echo
document.counter.d2.value='30'
However, the two single quote marks cause errors unless I go the extra way to fix it for it's specific situation.
bad script:
<?php
if ($x == 1)
{
echo ' document.counter.d2.value='30'';
}
?>
I can fix this by doing this:
<?php
if ($x ==1)
{
echo 'document.counter.d2.value='."'30'";
}
?>
But this is just an example of the type of situation I'm running across. The scripts I'm echoing sometimes contain both single and double quote marks in it(javascript with html).
Is there a way to just make everything from point A to B literal in the echo statement? I really don't want to have to adjust countless lines of javascript so they can be echoed. Any help/tips would be greatly appreciated.