Data dari dua tabel yang berbeda, menggunakan dua buah query.
<select class="form-control" required name="prodi">
<?php
$ql=mysql_query("SELECT * FROM file WHERE id_file='".$_GET['id']."' ");
$row=mysql_fetch_array($ql);
$query=mysql_query("SELECT * FROM tbl_prodi");
while($rowi=mysql_fetch_array($query))
{
if($rowi['id_prodi'] == $row['prodi'])
{
echo "<option value=$rowi[id_prodi] selected>$rowi[nama_prodi]</option>";
}else
{
echo "<option value=$rowi[id_prodi]>$rowi[nama_prodi]</option>";
}
}
?>
</select>
Tidak ada komentar:
Posting Komentar