HTML
<? while ($row = mysqli_fetch_array($permission_data)){?>
<tr>
<td class="manager"><?=$row["name"];?></td>
<td class="manager">
<input value="1" <?=$row["sta"]==1 ? "checked" : "";?> type="checkbox" name="sta[]" id="sta<?=$row["permission_id"];?>"><label for="sta<?=$row["permission_id"];?>"></label></td>
<td class="manager">
<input value="1" <?=$row["rpt"]==1 ? "checked" : "";?> type="checkbox" name="rpt[]" id="rpt<?=$row["permission_id"];?>"><label for="rpt<?=$row["permission_id"];?>"></label></td>
<td class="manager">
<input value="1" <?=$row["prd"]==1 ? "checked" : "";?> type="checkbox" name="prd[]" id="prd<?=$row["permission_id"];?>"><label for="prd<?=$row["permission_id"];?>"></label></td>
<td class="manager">
<input value="1" <?=$row["odr"]==1 ? "checked" : "";?> type="checkbox" name="odr[]" id="odr<?=$row["permission_id"];?>"><label for="odr<?=$row["permission_id"];?>"></label></td>
<td class="manager">
<input value="1" <?=$row["usr"]==1 ? "checked" : "";?> type="checkbox" name="usr[]" id="usr<?=$row["permission_id"];?>"><label for="usr<?=$row["permission_id"];?>"></label></td>
<td class="manager">
<input value="1" <?=$row["blg"]==1 ? "checked" : "";?> type="checkbox" name="blg[]" id="blg<?=$row["permission_id"];?>"><label for="blg<?=$row["permission_id"];?>"></label></td>
<td class="manager">
<input value="1" <?=$row["stg"]==1 ? "checked" : "";?> type="checkbox" name="stg[]" id="stg<?=$row["permission_id"];?>"><label for="stg<?=$row["permission_id"];?>"></label></td>
<td class="manager">
<input value="1" <?=$row["mng"]==1 ? "checked" : "";?> type="checkbox" name="mng[]" id="mng<?=$row["permission_id"];?>"><label for="mng<?=$row["permission_id"];?>"></label></td>
</tr>
<?}?>
Update
foreach ($_POST["sta"] as $key) {
echo $key;
}
now I check three, just print three 1
bits. I know which one to change, but I have no idea that the object I want to change is subscription (Manager Edit list Product Statistics)
Database structure
so after I finished writing, I found that
I unexpectedly checked the WHERE condition
, so I could not find that the user had changed the value.
so my mind died again.