pranshu82202 Posted December 15, 2011 Share Posted December 15, 2011 I have a php code... In which there is a link and i want to apply a javascript onclick event onthat link... echo "<a onclick=vieww_det(". $arr[$i].", ".$arr[$j].")>View Details </a>"; But its not working... Any help will be appreciated - Pranshu Agrawal pranshu.a.11@gmail.com Link to comment https://forums.phpfreaks.com/topic/253210-js-inside-php/ Share on other sites More sharing options...
kicken Posted December 15, 2011 Share Posted December 15, 2011 You need to put quotes around the value of your onclick attribute. Also, depending on the datatype of your variables, you may need quotes around them as well. echo '<a onclick="vieww_det('. $arr[$i].', '.$arr[$j].')">View Details</a>'; Link to comment https://forums.phpfreaks.com/topic/253210-js-inside-php/#findComment-1298057 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.