Чтобы обновить только часть страницы, вам нужно использовать JavaScript, а точнее AJAX.
Ajax позволяет отправлять HTTP-запросы и обновлять элементы страницы без полной перезагрузки страницы.
Вы можете попробовать что-то вроде этого
<script>
function refresh_items() {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("location_id").innerHTML =
this.responseText;
}
};
xhttp.open("GET", "refresh_list.php", true);
xhttp.send();
}
</script>
<select name="location_id" id="location_id" class="form-control" onclick="refresh_items();">
</select>
Теперь, когда вы создали свои клиентские сценарии, вы хотите, чтобы серверный PHP на refresh_list.php
выглядел примерно так
<?php
//all your SQL settings and stuff here
$sql = "SELECT * FROM locations";
$result = mysqli_query($conn, $sql);
while($row=mysqli_fetch_assoc($result)){ ?>
<option value="<?php echo $row['location_id'];?>">
<?php echo $row['location_name'];?></option>
<?php } ?>