Tekforums

Chat => Entertainment & Technology => Topic started by: neXus on June 09, 2007, 23:54:17 PM

Title: php echo/print - speech marks issue
Post by: neXus on June 09, 2007, 23:54:17 PM
onmouseover="showToolTip(event,texthere);return false" onmouseout="hideToolTip();"

How do you echo this?
I know you do  ""  for example if you have just one type of inline quote but if your using javascript as part of coding and your generating an aspect of code via php echo or pring does anyone know how you handle the above code to echo correctly?

echo (?);
Title: php echo/print - speech marks issue
Post by: M3ta7h3ad on June 10, 2007, 00:22:27 AM
$blah = "onmouseover="showToolTip(event,texthere);return false" onmouseout="hideToolTip();"";

Addslashes($blah);

:)

Or just \ every single speech mark.
Title: php echo/print - speech marks issue
Post by: neXus on June 10, 2007, 01:00:37 AM
Quote from: M3ta7h3ad$blah = "onmouseover="showToolTip(event,texthere);return false" onmouseout="hideToolTip();"";

Addslashes($blah);

:)

Or just \ every single speech mark.

Ill try the slashes the above value thing does not work, if you second look it you will see why becuase I tried that already :)
May do more variables spilt the showtooltip and the mousover as two variables, thanks though should help and all else fails as you say use the \
Title: php echo/print - speech marks issue
Post by: Sam on June 10, 2007, 08:35:15 AM
You have to escape like in all languages.
Its a pain in the arse when youre using a string literal for regular expressions.

\\\\\\\\\\\"
Title: Re:php echo/print - speech marks issue
Post by: neXus on June 10, 2007, 12:04:55 PM
I always try to avoid it but I think with Ajax taking off as it is probably going to get more common and a bit anoying