title: PHP get id of submit button
body: <p>I am trying to determine which bus has been picked for a reservation but unfortunately, I am not able to get the id properly</p>
  
  <pre><code>  $sql = $db-&gt;prepare("SELECT * FROM Departure WHERE RouteId = 3");
  
    $sql-&gt;execute();
  
    while($row = $sql-&gt;fetch(PDO::FETCH_ASSOC))
    {
      echo "&lt;tr&gt;&lt;td&gt;";
      echo $row['DepDate'];
      echo "&lt;/td&gt;&lt;td&gt;75&lt;/td&gt;&lt;td&gt;";
      echo $row['Seats'];
  
      echo"&lt;/td&gt;&lt;td&gt; &lt;input type='hidden' name='action' value='".$row['DepId']."' /&gt;&lt;input id='";
      echo $row['DepId'];
      echo "' type='submit' name='submit' value='Pick'&gt;&lt;/td&gt;&lt;/tr&gt;";   
    }
  </code></pre>
  
  <p>This code creates a table with the the busses from RouteId 3
  For whatever reason, no matter which button I click, only the value of the last one gets set when I call $_POST['action']</p>