<?php while($row = mysqli_fetch_array($result)): ?>
  <tr>
    <td><?php echo $row['mapid'] ?></td>
    <td><button id="m" type="button" value="<?php echo $row['map'] ?>" onclick="ready()">ddd</button></td>
  </tr>
  <?php endwhile;?>
  </table>
 
  <iframe id="k" src="" width="600" height="450" frameborder="0" style="border:0;" allowfullscreen="" aria-hidden="false" tabindex="0"></iframe>  
  
  <script>
  function ready() {
    var x = document.getElementById('m').getAttribute('value');
    var y =  "https://www.google.com/maps/embed?pb=";
    var z = y + x;
    alert(z);
    document.getElementById("k").src = z;
  }
</script>           
I do click button to open google map it work fine but it getting value from the first row because id is the same please help
 
    