depojones Posted May 28, 2010 Share Posted May 28, 2010 hello, The following is not working. Can someone help me out. echo '<li class="active"> <a href="#" onClick="popupBox('<p>School<br> House <br>Church</p>','<p></p>'); return false"> '.$row['student'].'</li>'; ?> Am trying to echo javascrippt within php query, but it doesn't seem working. note: The javascript is working without the php echo statement Thanks in advance Link to comment https://forums.phpfreaks.com/topic/203214-echo-javascript-in-php/ Share on other sites More sharing options...
kenrbnsn Posted May 28, 2010 Share Posted May 28, 2010 You have unescaped single quotes in your string. Since you've enclosed the string in single quotes, you need to escape any single quotes within the string. <?php echo '<li class="active"> <a href="#" onClick="popupBox(\'<p>School<br> House <br>Church</p>\',\'<p></p>\'); return false"> '.$row['student'].'</li>'; ?> Ken Link to comment https://forums.phpfreaks.com/topic/203214-echo-javascript-in-php/#findComment-1064732 Share on other sites More sharing options...
depojones Posted May 28, 2010 Author Share Posted May 28, 2010 Worked like charm Thanks Link to comment https://forums.phpfreaks.com/topic/203214-echo-javascript-in-php/#findComment-1064740 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.