Author Topic: php echo/print - speech marks issue  (Read 693 times)

  • Offline neXus

  • Posts: 8,749
  • Hero Member
php echo/print - speech marks issue
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 (?);

php echo/print - speech marks issue
Reply #1 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.

  • Offline neXus

  • Posts: 8,749
  • Hero Member
php echo/print - speech marks issue
Reply #2 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 \

  • Offline Sam

  • Posts: 3,943
  • Hero Member
php echo/print - speech marks issue
Reply #3 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.

\\\\\\\\\\\"

  • Offline neXus

  • Posts: 8,749
  • Hero Member
Re:php echo/print - speech marks issue
Reply #4 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

0 Members and 1 Guest are viewing this topic.