I am new to php I am trying to update classroom. In first loop i show all the classrooms in a table and it works fine and then i use another loop inside this loop which shows all the teacher against one row. mean if there is grade one then i try to show all the teacher at the end of the row in dropdown if admin want to change the teacher for this particular class. it shows all the teacher only in first row inside the dropdown but in second row it shows nothing. as you see in the picture first record in which classid is 22 this row have dropdown at the end it gives all the teacher in dropdown but all other rows down is empty picture to view the output. **
this is the code here
while ($row = mysqli_fetch_assoc($result)) {
?>
<tr>
<td><?php echo $row['id'] ?></td>
<td>
<?php echo $row['grade'] ?></td>
<td>
<form>
<select name="teacherDropdown" class="form-select bg-dark text-info">
<option selected>Select Teacher</option>
<?php
while ($mango = mysqli_fetch_assoc($getTeacher)) { ?>
<option value="<?php echo $mango['id'] ?>"><?php echo $mango['name'] ?></option>
<?php
}
?>
</select>
</form>
</td>
</tr>
<?php
}
?>