从下拉菜单中选择更改下拉菜单的内容

I have some dropdown menus. If I select one of them I want to change the other's content with something that is reliable with what i selected. How can I do that ? With html and php.

For example I have one table

Year   with  id_year  and  year          
Stuff  with  id_stuf  and  stuff

If I select an year in the first dropdown menu , in the other drodown menu will show only the stuff from that year .

This is my content with the dropdown menus

<div class="view">
    <form name="tabel" method="post" action="insertexamen.php">

    <table>
            <tr>
                <td>Data</td>
                <td><input type="date" name="data" value="data" required="required"/><br></td>
            </tr>

            <tr>
                <td>An</td>
                <td>
                    <?php
                        $sql_year="SELECT * FROM an";
                        $rez_year = mysqli_query($link,$sql_year);
                        echo "<select name=\"year\" >";
                            while($year=mysqli_fetch_array($rez_year))
                            {
                                echo "<option value=\"".$year['id_an']."\">".$year['grupa']."</option>";
                            }
                        echo "</select>";
                    ?><br>
                </td>
            </tr>

            <tr>
                <td>Materie</td>
                <td>
                    <?php
                        $sql_mat="SELECT * FROM materii";
                        $rez_mat = mysqli_query($link,$sql_mat);
                        echo "<select name=\"mat\" >";
                        while($mat=mysqli_fetch_array($rez_mat))
                        {
                            echo "<option value=\"".$mat['id_mat']."\">".$mat['numemat']."</option>";
                        }
                            echo "</select>";
                    ?><br>
                </td>
            </tr>

            <tr>
                <td>Profesor</td>
                <td>
                    <?php
                        $sql_proff="SELECT * FROM profesor";
                        $rez_proff = mysqli_query($link,$sql_proff);

                        echo "<select name=\"proff\" >";
                        while($proff=mysqli_fetch_array($rez_proff))
                        {
                            echo "<option value=\"".$proff['id_prof']."\">".$proff['numep']." ".$proff['prenumep']."</option>";
                        }
                            echo "</select>";
                    ?><br>
                </td>
            </tr>

            <tr>
                <td>Asistent</td>
                <td>
                    <?php
                        $sql_profff="SELECT * FROM profesor";
                        $rez_profff = mysqli_query($link,$sql_profff);

                        echo "<select name=\"profff\" >";
                        while($profff=mysqli_fetch_array($rez_profff))
                        {
                            echo "<option value=\"".$profff['id_prof']."\">".$profff['numep']." ".$profff['prenumep']."</option>";
                        }
                            echo "</select>";
                    ?><br>
                </td>
            </tr>

            <tr>
                <td>Sala</td>
                <td>
                    <?php
                        $sql_room="SELECT * FROM sala";
                        $rez_room= mysqli_query($link,$sql_room);

                        echo "<select name=\"room\" >";
                        while($room=mysqli_fetch_array($rez_room))
                        {
                            echo "<option value=\"".$room['id_s']."\">".$room['salaa']."</option>";
                        }
                            echo "</select>";
                    ?><br>
                </td>
            </tr>

            <tr>
                <td>Tip</td>
                <td>
                    <?php
                        $sql_type="SELECT * FROM examen";
                        $rez_type= mysqli_query($link,$sql_type);

                        echo "<select name=\"type\" >";
                        while($type=mysqli_fetch_array($rez_type))
                        {
                        echo "<option value=\"".$type['id_tip']."\">".$type['tip']."</option>";
                        }
                        echo "</select>";
                    ?><br>
                </td>
            </tr>

            <tr>
                <td><input name="submit" type="submit" value="Trimite"/></td>
                <td><input name="reset" type="reset" value="Reset"/></td>
            </tr>   
</table>

Are you looking for something like that:

<html>
<title>dropdownlist</title>
<head>
<script language="Javascript" type="text/javascript" >
function choix(formulaire)
{
var j;
var i = form1.boite1.selectedIndex;
if (i == 0)
for(j = 1; j <3; j++)
form1.boite2.options[j].text="";


else{
switch (i){
case 1 : var text = new Array( "London","Manchester","Birmingham");
break;
case 2 : var text = new Array("Paris","Marseille","Lyon");
break;

case 3 : var text = new Array("Berlin","Munich","Francfort");
break;
}

for(j = 0; j<3; j++)
form1.boite2.options[j+1].text=text[j];
}
form1.boite2.selectedIndex=0;
}
</script>
</head>
<body>
<form name="form1">
<select name="boite1" onChange="choix(this.form)">
<option selected>country</option>
<option>England</option>
<option>France</option>
<option>Germany</option>

</select>

<select name="boite2">
<option selected>cities</option>
<option></option>
<option></option>
<option></option>
</form>
</select>
</body>
</html>

if you want absolutely to do it using only html and php you will need to use some ajax because php is serverside and html is slient side. so for what you asy I would recommend the code above