This is the coding that I set for the times :
<div class="form-group">
<label for="Pickup">Pickup Time</label>
<input type="time" class="form-control timepicker" name="fld_booking_pickuptime" id="fld_booking_pickuptime" placeholder="hh:mm A" value="" required>
</div>
<div class="form-group">
<label for="StartTime">Program Time (Start)</label>
<input type="time" class="form-control timepicker" name="fld_booking_start" id="fld_booking_start" placeholder="hh:mm A" value="" required>
</div>
<div class="form-group">
<label for="EndTime">Program Time (End)</label>
<input type="time" class="form-control timepicker" name="fld_booking_end" id="fld_booking_end" placeholder="hh:mm A" value="" required>
</div>
This is the script that I use to disable time selection (I thought of replacing date with time in script, but I could be wrong since I really don't know any other ways for time, since I'm totally new in this) :
<?php
$times = array();
$time_query = "SELECT `tbl_bookings`.`fld_booking_pickuptime`, `tbl_bookings`.`fld_booking_start`, `tbl_bookings`.`fld_booking_end` FROM `tbl_bookings` WHERE status_delete=1";
$time_result = mysqli_query($link, $time_query);
if (mysqli_num_rows($time_result ) > 0) {
while ($row = mysqli_fetch_assoc($time_result )) {
$times [] = $row['fld_booking_pickuptime'], $row['fld_booking_pickuptime'], $row['fld_booking_pickuptime'];
}
}
?>
var array = <?= json_encode($times)?>;
$('input.timepicker').timepicker({
beforeShowDay: function(time){
var string = jQuery.timepicker.formatTime('hh:mm A', date);
return [ array.indexOf(string) == -1 ]
}
});
I want to fetch the respective times from database as the array, so that the times can be disabled for selection (using times that already in database). I am totally new in this, so I hope anyone can somewhat help me to fetch the times from database for the time selection disable. Thank you so much, totally appreciated ~