Hello,
I am trying to create a table with a checkbox for each row to delete the row that checked. Then after the user press the delete button the row that is checked must be deleted.
This is the code that I have so far, but I do not think it's complete yet.
products.php
<button type="button" onClick="parent.location='groupinfo_edit.php'">Delete</button>
<br><br>
<?php
//LOAD GROUP
$result = mysql_query("SELECT * FROM `group` ORDER BY group_id ASC") or die(mysql_error());
?>
<div style="border-color: grey; border-style: solid;">
<table id="admintable" border="1" cellpadding="2" cellspacing="0" width="800">
<tr>
<th><input type="checkbox" name="all" value=""></th><th>Product Picture</th><th>Product Name</th><th>Product Rate</th><th>Product Size</th><th>Product Price</th><th>Product Info</th><th>Action</th>
</tr>
<?php
$i=0;
while ($data = mysql_fetch_array($result)){
$result2=($i%2)?'#DFA09D':'white';
//echo "<tr bgcolor='$result2'>";
//echo '<td>'.$data['page'].'</td>';
//echo "<td><a href='post.php?post_id=".$data['post_ID']."'><img src='../images/post.jpg'></a></td>";
//echo '</tr>';
echo "<tr bgcolor='$result2'>";
echo '<td><input type="checkbox" name="eachproduct" value=""></td>';
echo '<td>Picture</td>';
echo '<td>Product Name</td>';
echo '<td>3 stars</td>';
echo '<td>Medium</td>';
echo '<td>Price</td>';
//LOAD MEMBERS
$resultG = mysql_query("SELECT * FROM `student` INNER JOIN `group`
ON student.group_id = group.group_id
WHERE `group_name` ='".$data['group_name']."'") or die(mysql_error());
echo '<td>Information</td>';
echo '<td><center><a href="groupmgt.php?group_id='.$data['group_id'].'">Edit</center></td>';
echo '</tr>';
$i++;
}
?>
</table>
</div>
</form>
</div>
</div>
</center>
</div>
Please help me to complete the code. Especially on the checkbox part, how can the computer distinguish if that row is being check and ready to be deleted?