title: Form only sending the last row from a form and not the selected one
body: <p>I have a table where each row in the table has a button that allows you to delete that particular row from the database. Although somehow my form only submits the last row and no the one I selected. Please ignore the deprecated tags, well aware of the issues. </p>
  
  <pre><code>&lt;?php
                  $result = mysql_query("SELECT * FROM booking");
  
                  while($row = mysql_fetch_array($result))
                  {
  
                  ?&gt;
  
                  &lt;form class='table-form' id='form' method='post'&gt;
  
                      &lt;tr&gt;
  
                      &lt;input id="bookid" type="hidden" name="bookid" value="&lt;?php echo ($row['booking_id']); ?&gt;" /&gt;
  
                      &lt;td&gt;
  
                      &lt;?php echo ($row['booking_id']);?&gt;
  
                      &lt;/td&gt;
                      &lt;td&gt;
                          &lt;?php echo ($row['user_id']); ?&gt;
                      &lt;/td&gt;
                      &lt;td&gt;
                          &lt;?php echo ($row['event_id']); ?&gt;
                      &lt;/td&gt;
                      &lt;td&gt;
                          &lt;?php echo ($row['payment_type']); ?&gt;
                      &lt;/td&gt;
                      &lt;td&gt;
                          &lt;?php echo ($row['booking_date']); ?&gt;
                      &lt;/td&gt;
                          &lt;center&gt;&lt;button type="submit" id="submit" name="submit"&gt;Cancel&lt;/button&gt;&lt;center&gt;
                      &lt;td&gt;
                      &lt;/td&gt;
                  &lt;/tr&gt;
  
  
  
  
                  &lt;?php
                  }
                  ?&gt;
  
  
                  &lt;/form&gt;
  
              &lt;/table&gt;
          &lt;/div&gt;
  
          &lt;?php
  
  
              if (isset($_POST['bookid'])){
  
                  $id =  ($_POST['bookid']);
  
                  $result = mysql_query("DELETE FROM booking
                  WHERE booking_id = '$id'");
  
          }
  ?&gt;
  </code></pre>