必须禁用前一个用户选中的所有复选框

问题描述 投票:0回答:1

databaseI have added image of seat selection layout我想要禁用所有记录(即用户选择的座位),但此代码仅获取最后一条记录并禁用它。

    <?php 
        $sqlcheck = "select * from booknow where hotel ='$test'";
        $resultcheck = mysqli_query($conn,$sqlcheck);
        while($rowcheck = mysqli_fetch_array($resultcheck))
        {
          $checkedcheck = $rowcheck['book'];  
          $expcheck=explode(",",$checkedcheck);
        }
    ?>

    <?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[]"class="tabtwo"style="width:30px;height:30px;"
            value="<?php echo "Two-seater A".$i;?>"
            <?php  if(in_array("Two-seater A".$i, $expcheck)) {?>
               onclick="this.checked=this.defaultChecked"<?php } else {echo "none";}?>>
         </div>
         <div class="secondc">
         </div>
        <label for="c1"style="margin-left:40px;"><b>A<?php echo$i?></b> 
        </label>
      </div>
      </div>
    <?php 
    $i++;
    }
    ?>
php html
1个回答
0
投票

试试下面的代码

while($rowcheck = mysqli_fetch_array($resultcheck))
  {
   $checkedcheck = $rowcheck['book'];  
   $expcheck[] =explode(",",$checkedcheck);

  }
© www.soinside.com 2019 - 2024. All rights reserved.