title: Delete a table row by an ID which is inside hidden field
body: <p>I have a table which generates its rows in a while loop as follows in JSP, (I use a hidden field in each row to get the specific ID and POST it to the servlet)</p>
  
  <pre><code>&lt;tr&gt;
      &lt;td&gt;&lt;center&gt;&lt;%  out.print(rs1.getString("teamid"));%&gt;&lt;/center&gt;&lt;input name="tid" type="hidden" value="&lt;%out.print(rs1.getString("teamid"));%&gt;"/&gt;&lt;/td&gt;
      &lt;td&gt;&lt;center&gt;&lt;%  out.print(rs1.getString("teamname"));%&gt;&lt;/center&gt;&lt;/td&gt;
      &lt;td&gt;&lt;center&gt;&lt;%  out.print(rs1.getString("teaminitials"));%&gt;&lt;/center&gt;&lt;/td&gt;
      &lt;td&gt;&lt;center&gt;&lt;%  out.print(rs1.getString("teamdesc"));%&gt;&lt;/center&gt;&lt;/td&gt;  
      &lt;td&gt;&lt;center&gt;&lt;input type="submit" class="greenbutton" name="delete" value="Delete"/&gt;&lt;/center&gt;&lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  
  <p>In the servlet,</p>
  
  <pre><code>String buttondelete = request.getParameter("delete");
      if(buttondelete!=null){
      String tid = request.getParameter("tid");
  
          try {
              clmmodel_database.updateQuery("delete from clm_team where teamid = '"+tid+"'");
              response.sendRedirect("clmview_teamlist.jsp");
          } catch (Exception e) {
          }
  
      }
  </code></pre>
  
  <p>But this deletes always the first row of the table, not the row I need to delete. Please show me where I have done the mistake or suggest me a way.</p>