Jump to content

Needing a third quote, not sure the code.


Cluadia

Recommended Posts

Hi, I'm relatively new to writing php. This may be a rather generalized question, my knowledge of programming as a whole isn't too complete :D I've tried searching for an answer to this for some time, but I'm struggling in finding what exactly to search for.I'm wondering about what happens when you run into a scenario where you need to put in 3 quotes. Say, you have a php which echos html code. And a scenario where you have to define the onmousedown in say, a link, which uses 1 quote, a javascript function which uses the 2nd one, and the parameters needed to be passed which uses 3 total. It's been something I missed learning a long time ago and would like to correct that.I've been making it by via doing a work around as described below.

<?phpecho '<a href="#" name="'. $link_name.$number .'"  id="' . $link_description.'" onmousedown="ajax_zee(this.name,this.id);">?>

I genuinely appreciate any help on the matter, I thank you!

Link to comment
Share on other sites

If you need to nest multiple levels of the same type of quote you can use multiple backslashes (as \\\" => \" => ").

echo "function test() {   document.write(\"<div onclick=\\\"test\\\"></div>\");}";

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...