At the moment, I am trying to create two drop down menus that will act as time intervals. My goal is to set it up where if the user selects a year in the first drop down menu, then the next menu will automatically populate with values that are >= the first menu selection. Here is both drop down menus that gather years by querying to my database.
<p class = 'year'>
<label for="year">
Please select a year
</label>
<select name= 'year'>
echo "<option value= ''> </option>";
<?php
$query = "select distinct year from table";
$result = $conn->query($query);
while($row = $result->fetch_object()) {
echo "<option value='".$row->year."'>".$row->year."</option>";
}
?>
</select>
</p>
<p class = 'year'>
<label for="year">
Please select a year
</label>
<select name= 'year2'>
echo "<option value= ''> </option>";
<?php
$query = "select distinct year from table";
$result = $conn->query($query);
while($row = $result->fetch_object()) {
echo "<option value='".$row->year."'>".$row->year."</option>";
}
?>
</select>
</p>
Both of these drop down menus gather years from my database. Instead, I want my year2 menu to grab only the years >= the year value that the user selects in the first drop down menu. My question is how do I go about doing this? Do I still have to create three separate files, JQuery file, function file, and this file, or, is there a simpler way to go about this? Any help would be greatly appreciated.