How to set permissions for managers? If there is a problem with the modification, WHERE.? under the revision method.

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

clipboard.png

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.


  1. assign the value of checkbox to permission_id
  2. monitors the check action of checkbox. Once you click modify value, to add 1 (for checked) or 0 to the principle persission_id, the final format is like < input value= "23-1". >
  3. After the
  4. server gets the value, if it is found that it contains -, it means that the value has changed, and the result of the change will be followed by 1 or 0.
Menu