首页 > 解决方案 > 想要禁用选中的复选框

问题描述

我想禁用 user1 选择的复选框,这样如果另一个用户登录该页面,他应该无法对选定的复选框进行任何更改。这有点像餐厅餐桌预订系统

<?php 
 $st = "select * from seat where hotel='$test'";
 $q= mysqli_query($conn,$st);
 $tester = mysqli_fetch_array($q);
 $tab = $tester['two'];
?>

<form method="post">
<input type="submit" name="bookbtn" value="Book Your table">
<div id="mask2"style="float:left;width:20%;">
    <?php $i=1;
      while ($i<=$tab) 
      {?>
        <div class="TWO">
          <div class="check"style="height:40px;width:120px;">
            <div class="seconda">
            </div>
            <div class="secondb">
              <input type ="checkbox"name="checky[]"
              style="width:30px;height:30px;"
              value="<?php echo "two".$i;?>"
              <?php if (in_array("two".$i, $expcheck)) {?>
               checked="checked"<?php }else {echo "none";}?>>
         </div>
            <div class="secondc">
            </div>
        </div>
    </div>

标签: javascriptphp

解决方案


在您确定它已被选中后:

document.getElementByID('yourcheckboxID').setAttribute("disabled", "true");

推荐阅读