私のデータベースの多くの行を選択し、ユーザーがそれらのいずれかを選択できる行のいずれかのチェックボックスを持っています。私はユーザーの選択に従ってデータベースを更新する必要がありますが、このチェックボックスの誰が選択されているのか理解できません。どのチェックボックスが選択されているかを理解するには?
おかげでたくさん... semicodeはここにある:
は、すべてのチェックボックスにクラスを提供します:JSで
<input type="checkbox" class="MyChkbox" id="$b" name="checkboxName[]" value="yes"/>';
$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>";
}
}