I am trying to use a php variable in javascript in the following way but its not working. Can anybody let me know what is wrong in the below code
include './connection.php';
$rating[]=$_GET['rating'];
echo '<script>';
echo 'document.getElementById(' .$rating. ').checked = true;';
echo '</script>';
echo 'document.getElementById("' .$rating. '").checked = true;';