如何禁用从数据库中获取的多个复选框的值

时间:2019-04-07 07:53:01

标签: javascript php html

我正在建立一个用于餐厅餐桌预订的网站,并且想要禁用某些用户已经选择的从数据库中提取的多个复选框的值,以使其他用户无法对此进行任何更改。

 //fetching number of tables in $tab  as given by restaurant owner.
<?php 
 $st = "select * from seat where hotel='$test'";
 $q= mysqli_query($conn,$st);
 $tester = mysqli_fetch_array($q);
 $tab = $tester['two'];
?>



 //fetching checked checkbox value from database
    <?php 
    $sqlcheck = "select * from booknow where hotel ='$test'";
    $resultcheck = mysqli_query($conn,$sqlcheck);
    $rowcheck = mysqli_fetch_array($resultcheck);
    $checkedcheck = $rowcheck['book'];  
    $expcheck=explode(",",$checkedcheck);
    ?> 



 //table layout
    <form method="post">
    <input type="submit" name="bookbtn" value="Book Your table" onclick="bookbtn()"/>
    <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>
     <?php 
     $i++;
    }
    ?>  
</div>
</form> 

0 个答案:

没有答案