I'm creating a visual table reservation system and in order to signify that a certain table is booked, it will become disabled.
*the code is not done yet but I'm trying to figure out first how I can add properties using jQuery inside a php conditional statement**
php code:
<?php
include "php/dbconn.php";
$sql = "SELECT id FROM place";
$tables = mysqli_query($conn, $sql);
while ($tablesrow = mysqli_fetch_array($tables)) {
$flag = false;
#check muna kung walang schedule conflict
$sql = "SELECT place FROM reservation WHERE status=0 AND (date='$date' AND starttime <=
'$endtime' AND endtime >='$starttime;')";
$bookedresult = mysqli_query($conn, $sql);
while ($bookedrow = mysqli_fetch_array($bookedresult)) {
if ($bookedrow["place"] == $tablesrow["id"]) {
$flag = true;
// echo $bookedrow["place"];
}
}
if (!$flag) {
// echo "<option>" . $tablesrow["id"] . "</option>";
echo "<script>";`
` Then the javascript inside (this is a continuation of php code) where I wish to add a disabled attribute to the input checkbox with id #tblc_1
$(window).load(function () {$('#tbl-c').attr('disabled', true);});
This is for the html checkbox
<div class="tbl-c-cont">
<div class="tbl-c tbl-c1">
<span>
<input type="checkbox" id="tblc_1" value="tblc_1" name="tbl_id[]">
</span>
</div>
<div class="tbl-c tbl-c2 ">
<span>
<input type="checkbox" id="tblc_2" value="tblc_2" name="tbl_id[]">
</span>
</div>
It doesn't work and I don't receive the achieved results.