很簡單加入 php 讀資料庫
一個是value的值要改 另一個是要改顯示的值<option value=php><php><o/ption>
<option name="administration_Title" value="<?php echo $academic_Title[$i]; ?>"><?php echo $academic_Title[$i]; ?></option>
<?php $data = mysql_fetch_row(mysql_query("select * from Professor_Information where id='$teacherID'", $conn)); ?>
<select name="academic_Title">
<?php
$academic_Title[0] = "Professor";
$academic_Title[1] = "Associate Professor";
$academic_Title[2] = "Assistant Professor";
$academic_Title[3] = "Lecturer";
$academic_Title[4] = "Adjunct Professor";
$academic_Title[5] = "Adjunct Associtate Professor";
$academic_Title[6] = "Adjunct Assistant Professor";
$academic_Title[7] = "Adjunct Lecturer";
$academic_Title[8] = "Academic Title";
if (($data[3])==null) {
echo "空值";
}
else
{
echo "不是空值";
for($i=0; $i<count($academic_Title); $i++){ //count($academic_Title) 計算陣列數
if (($data[3])==$academic_Title[$i]){ ?>
<option selected="true" name="administration_Title" value="<?php echo $academic_Title[$i]; ?>"><?php echo $academic_Title[$i]."(已選擇)"; ?></option>
<?php
}
else{ ?>
<option name="administration_Title" value="<?php echo $academic_Title[$i]; ?>"><?php echo $academic_Title[$i]; ?></option>
<?php
}
}
}
?>
</select>
留言列表