title: how to send a selected database value that is inside loop to another page in php
body: <p>i have made a form in php and inside form there is a loop that extracts multiple values from database(img,name,availability,..) for multiple books i have made a table to display those values to user and after displaying these data in table i have made an issue button inside loop so that every book has its issue button. </p>
  
  <p><strong><em>My problem is that i have to only retrieve id of that book for which user click issue button. i tried storing it in cookie but it send the id of the first book displayed then i tried get method but that results in sending the last book that is displayed on screen id. but i want is that it should send the id of book which is selected by user</em></strong></p>
  
  <p>display books</p>
  
  <pre><code>
      echo "&lt;form action='issue.php' method='get'&gt;";
                  while ($row= mysqli_fetch_array($result)) {
  
                      echo "&lt;div id='img_div' style='background-color:#fff;'&gt; ";
                      echo "&lt;img src='books/".$row['image']."'&gt;";
                      // echo "&lt;/div&gt;";&lt;div id='text'&gt;
                      $isbn=$row['isbn'];
  
                      echo "&lt;input type='hidden' name='isb' value='$isbn' /&gt;";
                      echo "&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;table&gt;";
  
  
                      echo "&lt;tr&gt;&lt;td&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;NAME&lt;/td&gt;&lt;td&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;".$row['name']."&lt;/td&gt;&lt;/tr&gt;";
                      echo "&lt;tr&gt;&lt;td&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;AVAILABILITY&lt;/td&gt;&lt;td&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;".$row['availabilty']."&lt;/td&gt;&lt;/tr&gt;";
                      echo "&lt;tr&gt;&lt;td&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;CATEGORY&lt;/td&gt;&lt;td&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;".$row['category']."&lt;/td&gt;&lt;/tr&gt;";
                      echo "&lt;tr&gt;&lt;td colspan='2'&gt;
  
                      &lt;button type='submit' name='issue'&gt;issue&lt;/button&gt;&lt;/td&gt;&lt;/tr&gt;";
                      echo "&lt;/table&gt;";
                      echo "&lt;/div&gt;&lt;br/&gt;";
                      if (isset($_GET['issue'])) {
                          # code...
                          $bookid=$isbn;
                      setcookie("bid",$bookid);
                          if(!isset($_COOKIE['bid'])){
                              echo "COOKIE NOT SET";
                          }
                          else{ 
                              echo "COOKIE SET SUCCESSFULLY";
                          }
                      }
  
  </code></pre>
  
  <p>issue.php(in which i want to send id)</p>
  
  <pre><code>
      if(isset($_GET['issue'])){
                  $bookid=$_GET['isb'];
  
      $dbser="localhost";
                  $use="[redacted]";  
                  $pasw="[redacted]";
                  $db="[redacted]";
                  $con=mysqli_connect($dbser,$use,$pasw,$db);
                  mysqli_select_db($con,$db)or die("db not connected");
                      $userid=$_COOKIE['id'];
                      $id=$_SESSION['user']['username'];
                      $query = "select id from user_account where username='$id'";
                      $result=mysqli_query($con,$query);
                      $row= mysqli_fetch_assoc($result);
                          $uid=$row['id'];
  
  
  
                      echo "$uid";
                      echo "&lt;br/&gt;";
                      echo "$bookid";
                              $query = "INSERT INTO issue (bookid, userid)
                   VALUES ('$bookid', '$uid')";
               mysqli_query($con, $query)or die(mysqli_error($con));
  
  </code></pre>