toolman Posted April 28, 2010 Share Posted April 28, 2010 Hi, I am trying to integrate some javascript into some PHP, but I cannot work out how to escape the quotes. This is what I have without any escapes: ' . ( trim($prod['prodDesc'])!='' ? ' <a href="javascript:animatedcollapse.toggle('michael')">Toggle</a> <div id="michael" style="width: 300px; background: #E7FFCC; display:none"> <b>Content inside DIV!</b><br /> <b>Note: Fade effect enabled. Height programmically defined. DIV hidden using inline CSS.</b><br /> </div> <h3>{{txt_prod_desc}}</h3> ' . nl2br($p->getTranslation('desc',$_SESSION['lang'],$prod['prodID'],1)) Could someone help me work out how to make the javascript work within the PHP? Many thanks Link to comment https://forums.phpfreaks.com/topic/200025-javascrip-in-php-help/ Share on other sites More sharing options...
ChemicalBliss Posted April 28, 2010 Share Posted April 28, 2010 You escape quotes with a backslash. eg: $myvar = "Some String, with a \" in it"; $myothervar = 'A Literal String, with a \' in it'; -cb- Link to comment https://forums.phpfreaks.com/topic/200025-javascrip-in-php-help/#findComment-1049846 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.