I have an HTML Form with 2 select inputs (race_type and race). The first select input is being populated from a mysql database table. The second select input of the form should be populated from the database based on the value of the first select input. I want every time i change the first selection the second selection to be automatically populated again based the new value. How can i achieve that?
<form action="hidden/add_training.php">
<select name="race_type" id="race_type" style="width:300px;" >
<option value="">Επέλεξε είδος:</option>
<?php
while ($category = mysqli_fetch_array($select_all_race_types,MYSQLI_ASSOC)):;
?>
<option value="<?php echo $category["Race_TypeID"];
?>"
<?php if(isset($_SESSION["u_kentroID"])) {if($_SESSION["u_kentroID"]==$category["kentroID"]) {echo ' selected';} } ?>>
<?php echo $category["name"];
?>
</option>
<?php
endwhile;
?>
</select>
</br></br>
<select name="race" id="race" style="width:300px;">
<option value="0">Επέλεξε αγώνισμα:</option>
<?php
while ($category = mysqli_fetch_array($select_all_races,MYSQLI_ASSOC)):;
?>
<option value="<?php echo $category["RaceID"];
?>" <?php if(isset($_SESSION["u_kentroID"])) {if($_SESSION["u_kentroID"]==$category["kentroID"]) {echo ' selected';} } ?>>
<?php echo $category["name"];
?>
</option>
<?php
endwhile;
?>
</select>
</br></br>
<input type="submit">
</form>
I want the second select input to be populated from Mysql database based on the value of the first select input
