0
我想選擇我的數據庫的很多行,並有用戶可以選擇任何行的任何行的複選框。然後我應該更新數據庫根據用戶的選擇,但我不明白這個複選框是誰選擇。如何理解選中的複選框?
非常感謝...... 的semicode是在這裏:
$query = "Select * mytable limit 30;";
$res = $mysql->ExecuteStatement (array());
echo '<form method="post" action=""> ';
$b=0;
while ($rec=$res -> fetch())
{
echo '<input type="checkbox" id="$b" name="checkboxName[]" value="yes"/>';
$checkboxID = "number_".$rec["ID"].":";
echo $checkboxID;
echo $rec["column1"]."</br>";
$b++;
}
if(isset($_POST['formSubmit'])) //this code just get us how many of checkbox are chosen not who are chosen
{
foreach($_POST['checkboxName'] as $selected)
{
echo $selected."</br>";
}
}