title: Get the id of the row from database on click of a button
body: <p>I guess this should be easy for the experts here ... I am using wordpress and I am fetching images from the mysql database with below code. And I display the image and there is a button just with every image and what I want is that when that button is pressed the id of that row of database that is fetched is printed on the screen. But below code only shows the last id. </p>
  
  <p>Below is my code ... I want that on each button click I get that particular row id from database and print on screen with echo</p>
  
  <p>Code</p>
  
  <pre><code>$sql = "SELECT * FROM 1user";
  $results = $wpdb-&gt;get_results($sql) or die(mysql_error());
  
  foreach( $results as $result ) {
  echo '&lt;form action="" method="post"&gt;';
  echo "&lt;img src='$result-&gt;path' width='150' height='150' &gt;" . '&lt;br&gt;&lt;br&gt;'.'&lt;input type="submit" name="show" id="show" value="Upvote"&gt;&lt;/form&gt;';    
  
  }
  
  if(isset($_POST['show'])){
  
  echo "&lt;br&gt;".$result-&gt;path;
  }
  </code></pre>