想要禁用选中的复选框

时间:2019-04-06 10:51:54

标签: javascript php

我想禁用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>

2 个答案:

答案 0 :(得分:0)

确定已选择它之后:

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

答案 1 :(得分:0)

just written disabled and it works

<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";}?>disabled>
         </div>
            <div class="secondc">
            </div>
        </div>
    </div>