Help: Get The Name Of CheckBoxes That Is Checked In A Search
Posted: Mon Dec 29, 2008 1:42 pm
Hi
I print out rows from a database in a table like this
echo '<form action="" method="POST">';
for($i=0;$i<$num;$i++)
{
echo '<tr>';
echo '<td style="width: 300px" class="style11">
<span lang="en" class="style13"><a href="HomeDetails.php">Description</a></span></td>';
$record=mysql_result($result,$i,'Price');
echo '<td style="width: 300px" class="style15">
<span lang="en" class="style13"><strong>'.$record.'</strong></span></td>';
$record=mysql_result($result,$i,'Space');
echo '<td style="width: 300px" class="style15">
<span lang="en" class="style13"><strong>'.$record.'</strong></span></td>';
$record=mysql_result($result,$i,'City');
echo '<td style="width: 400px" class="style15">
<span lang="en" class="style13"><strong>'.$record.'</strong></span></td>';
$record=mysql_result($result,$i,'State');
echo '<td style="width: 400px" class="style15">
<span lang="en" class="style13"><strong>'.$record.'</strong></span></td>';
$record=$i+1;
echo '<td style="width: 100px" class="style15">
<span lang="en" class="style13"><strong>'.$record.'</strong></span></td>';
$record=mysql_result($result,$i,'ID');
echo '<td class="style15"style="width: 100px" class="style11">
<input type="checkbox" name=chckbx'.$record.'></td>';
echo '</tr>';
}//end of for
echo '</table></div><input type="submit" name="BtnDel" value="Delete"></form>';
Now I want to submit this form to the next page and there I want to delete all rows where the checkbox have been checked.
My problem is: How do I get the selected ones?
Let's say that row1 and row 3 is checked. Then I would like to get the value 1 and 3 so I can remove the rows in the database with this id.
On this page there will be a lot of other checkbox.(If that is possible?)
I print out rows from a database in a table like this
echo '<form action="" method="POST">';
for($i=0;$i<$num;$i++)
{
echo '<tr>';
echo '<td style="width: 300px" class="style11">
<span lang="en" class="style13"><a href="HomeDetails.php">Description</a></span></td>';
$record=mysql_result($result,$i,'Price');
echo '<td style="width: 300px" class="style15">
<span lang="en" class="style13"><strong>'.$record.'</strong></span></td>';
$record=mysql_result($result,$i,'Space');
echo '<td style="width: 300px" class="style15">
<span lang="en" class="style13"><strong>'.$record.'</strong></span></td>';
$record=mysql_result($result,$i,'City');
echo '<td style="width: 400px" class="style15">
<span lang="en" class="style13"><strong>'.$record.'</strong></span></td>';
$record=mysql_result($result,$i,'State');
echo '<td style="width: 400px" class="style15">
<span lang="en" class="style13"><strong>'.$record.'</strong></span></td>';
$record=$i+1;
echo '<td style="width: 100px" class="style15">
<span lang="en" class="style13"><strong>'.$record.'</strong></span></td>';
$record=mysql_result($result,$i,'ID');
echo '<td class="style15"style="width: 100px" class="style11">
<input type="checkbox" name=chckbx'.$record.'></td>';
echo '</tr>';
}//end of for
echo '</table></div><input type="submit" name="BtnDel" value="Delete"></form>';
Now I want to submit this form to the next page and there I want to delete all rows where the checkbox have been checked.
My problem is: How do I get the selected ones?
Let's say that row1 and row 3 is checked. Then I would like to get the value 1 and 3 so I can remove the rows in the database with this id.
On this page there will be a lot of other checkbox.(If that is possible?)