Assume a table which shows list of students retrieved from database. After every record there must be a checkbox and the records corresponding to selected checkboxes must be inserted into another table.
This is the code for my dynamic table
<div>
<center>
<table>
<thead>
<tr>
<th> Roll No </th>
<th> Name </th>
<th> Department </th>
<th> Bus route </th>
<th> Accept </th>
</tr>
</thead>
<%
while(resultset.next())
{
%>
<tbody>
<tr>
<td height="30" nowrap align="center"><%out.println(resultset.getString("std_id")); %></td>
<td nowrap align="center"><%out.println(resultset.getString("std_name")); %></td>
<td nowrap align="center" class="rtpad"><%out.println(resultset.getString("dept")); %></td>
<td nowrap align="center" class="rtpad"><%out.println(resultset.getString("bus_id")); %></td>
<td> <input type="checkbox" name="chk[]"> </td>
</tr>
</tbody>
<% }
%>
</table>
<input type="button" value="Accept" name="btn_accept" id="btn_accept">
</center>
</div>
On clicking Accept button, records whose corresponding checkboxes were selected has to be inserted into another table.
Consider just printing the records that are selected for test case.
I have been trying since some time but i am unable to match case.
Please help me solving this problem.
Thanks in advance.
Aucun commentaire:
Enregistrer un commentaire