I have 2 dropdown options but I want them to be retrieved once the first dropdown value is selected or like the second dropdown options depend on the first dropdown option
<select name="campusselect">
<?php
$result= $conn->query("select campus_name from campus");
while( $row = $result->fetch_assoc()) {
$campus_name=$row['campus_name'];
echo "<option value='$campus_name'>$campus_name</option>";
}
?>
</select>
<!--room drop down-->
<select name="roomsselect">
<?php
$result= $conn->query("SELECT room_name FROM rooms WHERE room_campus=".$campus_name);
while( $row = $result->fetch_assoc()) {
$room_name=$row['room_name'];
echo "<option value='$room_name'>$room_name</option>";
}
?>
</select>