mysql テーブルから取得したレコードの正しい値を表示するドロップダウン リストがあります。以下は私がこれまでに試したことです:
<strong>Authority Id: *</stong><select name="authid">
<?php
$authid = $row['AuthorityId'];
$selectedId = array(
5, 6, 7);
$selection = array(
5 => "Admin",
6 => "Employee",
7 => "Student" );
foreach($selection as $value){
$text = $value;
echo '<option value="'.$selectedId.'" selected="'.$authid.'">'.$text.'</option>';
}
?>
</select>
しかし、正しい値が表示されません。誰かがここで何がうまくいかなかったのかを理解するのを手伝ってもらえますか? ありがとう。