so, this is my first time trying dynamic drop down list. So, i've copied the code from my teachers, and in my case, the option values dont shows up. this is my code :
<?php
$sql = "SELECT * FROM soal;";
$query = mysqli_query($connection, $sql);
?>
<div id="container">
<form action= ""method="">
<select name= "id_soal">
<option>-- Pilih Soal --</option>
<?php if (mysqli_num_rows($sql) >0){?>
<?php while ($row=mysql_fetch_array($sql)) {?>
<option><?php echo $row['soal_id']?> </option>
<?php } ?>
<?php } ?>
</select>
<input type = "submit" value= "OK" name="ok_submit"/>
</form>
</div>
this is my output : drop down list output
and of course this is my db : database picture
please tell me where o i get it wrong?T-T
so, from @user3783243 advise, i changed the code to be like this :
<?php
$sql = "SELECT * FROM soal;";
$query = mysqli_query($connection, $sql);
?>
<div id="container">
<form action= ""method="">
<select name= "id_soal">
<option>-- Pilih Soal --</option>
<?php if (mysqli_num_rows($query) >0){?>
<?php while ($row=mysql_fetch_array($query)) {?>
<option><?php echo $row['soal_id']?> </option>
<?php } ?>
<?php } ?>
</select>
<input type = "submit" value= "OK" name="ok_submit"/>
</form>
</div>
but still, the opetions dont show up.. T-T.. or,did i changed it wrong? because i'm literally new with programming.