doubu7425 2019-04-07 07:53
浏览 37

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

I am making a site for restaurant table booking, and want to disable the fetched multiple checkbox value from database that has already been selected by some user so that other user can not make any changes to those.

 //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条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 关于#hadoop#的问题
    • ¥15 (标签-Python|关键词-socket)
    • ¥15 keil里为什么main.c定义的函数在it.c调用不了
    • ¥50 切换TabTip键盘的输入法
    • ¥15 可否在不同线程中调用封装数据库操作的类
    • ¥15 微带串馈天线阵列每个阵元宽度计算
    • ¥15 keil的map文件中Image component sizes各项意思
    • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
    • ¥15 划分vlan后,链路不通了?
    • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据