i need help, i want to pass a value to javascript from php and it keeps giving me "null". i want to get what picture the user selected.
<?php
mysql_connect('localhost','root','');
mysql_select_db("ajax");
$query="SELECT * FROM xxxx";
$result= mysql_query($query);
while($row= mysql_fetch_array($result)){
$rating=$row['ID'];
echo "<img src =\"" .$row['filepath']."\" /><br/><a id=".$row['ID']." value='rating' onclick='getrating();'> likes". $row['likes']."<a/><br/>";
}
im trying to get what picture the user selected to rate.
?>
<script type="text/javascript" >
function getrating(){
var x= document.getElementById("<?php echo $row['ID']; ?>");
alert(x)
}
</script>