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 [email protected] Quote 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>'; Quote Link to comment https://forums.phpfreaks.com/topic/253210-js-inside-php/#findComment-1298057 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.