title: Passing on ID on button click, for every user
body: <p>I'd like to have an edit button for each database entry, and when the user clicks edit, it will only get the entry, that's alongside it. I've tried to use a hidden input like <code>&lt;input type="hidden" name="userid" value=...&gt;</code> but I don't really know where to put it, and how it could help.</p>
  
  <p>So you can visualise it as well, I attached a photo of the table.</p>
  
  <p><a href="https://i.stack.imgur.com/4m0Qb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4m0Qb.png" alt="enter image description here"></a></p>
  
  <p>I hope you can help me, and if there's any other information that you need to know, just let me know please.</p>
  
  <pre><code>&lt;?php
  include 'dbConnect.php';
  echo '&lt;table border="1" cellpadding="1" cellspacing="1" width="90%" style="margin: 0 auto"&gt;';
  echo '&lt;tr class="allUsers"&gt;';
  echo '&lt;th&gt;Username&lt;/th&gt;';
  echo '&lt;th&gt;First name&lt;/th&gt;';
  echo '&lt;th&gt;Last name&lt;/th&gt;';
  echo '&lt;th&gt;Email&lt;/th&gt;';
  echo '&lt;th&gt;Year group&lt;/th&gt;';
  echo '&lt;th&gt;Subject 1&lt;/th&gt;';
  echo '&lt;th&gt;Subject 2&lt;/th&gt;';
  echo "&lt;th&gt;Subject 1's teacher&lt;/th&gt;";
  echo "&lt;th&gt;Subject 2's teacher&lt;/th&gt;";
  echo '&lt;th&gt;Privilege&lt;/th&gt;';
  echo '&lt;th&gt;&lt;/th&gt;';
  echo '&lt;/tr&gt;';
  $getUsers = mysqli_query($connection, "SELECT * FROM users");           
  while($users=mysqli_fetch_assoc($getUsers)){
      echo '&lt;form method="post" action=""&gt;';
      echo '&lt;tr&gt;';
      echo '&lt;td&gt;'.$users['username'].'&lt;/td&gt;';
      echo '&lt;td&gt;'.$users['first_name'].'&lt;/td&gt;';
      echo '&lt;td&gt;'.$users['last_name'].'&lt;/td&gt;';
      echo '&lt;td&gt;'.$users['email'].'&lt;/td&gt;';
      echo '&lt;td&gt;'.$users['year_group'].'&lt;/td&gt;';
      echo '&lt;td&gt;'.$users['subject'].'&lt;/td&gt;';
      echo '&lt;td&gt;'.$users['subject2'].'&lt;/td&gt;';
      echo '&lt;td&gt;'.$users['teacher'].'&lt;/td&gt;';
      echo '&lt;td&gt;'.$users['teacher2'].'&lt;/td&gt;';
      echo '&lt;td&gt;'.$users['is_admin'].'&lt;/td&gt;';
      echo '&lt;td&gt;&lt;button name="editUser"&gt;Edit&lt;/button&gt;&lt;/td&gt;';
      echo '&lt;/tr&gt;';
      echo '&lt;/form&gt;';
  }
  if (isset($_POST['editUser'])){
      $username = $_SESSION['name'];
      // ....
  }   
  }
  echo '&lt;/table&gt;';
  ?&gt; 
  </code></pre>