Id like to change dropdown menu option that come from a database when the user selects between 2 option in radio button. Then the dropdown would change according to what he has selected.
echo "<input type='radio' name='vrsta' value='Pes' checked> Pes";
echo "<input type='radio' name='vrsta' value='Mačka'> Mačka<br>";
echo "<select name='pasme'>";
$sql_pasme = 'SELECT * FROM pasme;';
$result_pasme = mysqli_query($link, $sql_pasme);
while($row = mysqli_fetch_array($result_pasme))
{
echo "<option value= ' ".$row['ime']." '>{$row['ime']}</option>";
}
echo "</select><br>";
The radio button options are 2 options and i want when user selects one the dropdown menu would show the suboptions the selected one has so you can choose from. The bottom one is my dropdown menu load code from php. But this one displays every suboption not just between 1. AND i d like to choose from
SELECT p.ime FROM pasme p INNER JOIN vrste_zivali vz ON p.vrsta_id=vz.id WHERE
(vz.ime ='Pes');
and
SELECT p.ime FROM pasme p INNER JOIN vrste_zivali vz ON p.vrsta_id=vz.id WHERE
(vz.ime ='Mačka');