Mayank23 0 Light Poster

I want to make a rating system that uses ajax for the rating.
i use php and call all of the images, then i want to use ajax to post all the votes to a php script. However, i dont know how to get the elements. I want to be able to identify which picture the user selected.

        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <a href="upload.html"> Upload pics </a><br/>
       $query="SELECT * FROM xxxxx";
       $result= mysql_query($query);

       while($row=  mysql_fetch_array($result)){
echo "<img src =\"" .$row['filepath']."\" /><br/><button name='subject' id='x' type='submit'>".$row['xxxxx']."</button><br/>";
            <script type="text/javascript" >
                var x = document.getElementById("x");     I want to be able to identify which picture the user selected. 
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.