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>