I have this php code with a sql query and I want the page(more like a part of the page) to update without page reload. I also have a button that when I click it updates the variable(?date=) on the link. What I want now is to also execute this block of code without page reload.
Here are pictures what I want to achieve:
[So when I click the date, it updates the ?date variable on the link][1]
[and I want this to also update based on the sql query I have without reloading the page][2]
<?php
if (isset($_GET["date"])) {
foreach ($db->query("SELECT DayName, StartTime, EndTime FROM event_availability
INNER JOIN days ON days.DayID = event_availability.DayID
WHERE EventID = ? AND DayName = ?", $_GET["eventid"], date('l', strtotime($_GET["date"]))) as $availtime) {
?>
<?php
$i = 1;
$start = date('h:i A', strtotime($availtime["StartTime"]));
$end = $availtime["EndTime"];
while (strtotime($start) <= strtotime($end)) {
?>
<input type="radio" class="btn-check shadow-none" name="timeradio" id="btnradio<?php echo $i ?>" autocomplete="off">
<label class="btn btn-outline-primary" for="btnradio<?php echo $i ?>"><?php echo $start ?></label>
<?php
$start = date("h:i A", strtotime("$start + 30 mins"));
$i++;
}
?>
<?php
}
}
?>
[1]: https://i.stack.imgur.com/lHxCq.png
[2]: https://i.stack.imgur.com/aQP5k.png