echo '<select>';
echo '<option value="1">Option 1</option>';
echo '<option value="2">Option 2</option>';
echo '<option value="3">Option 3</option>';
echo '</select>';
$options = array('Option 1', 'Option 2', 'Option 3');
echo '<select>';
foreach ($options as $key => $value) {
echo '<option value="'.$key.'">'.$value.'</option>';
}
echo '</select>';
$options = array('1' => 'Option 1', '2' => 'Option 2', '3' => 'Option 3');
echo '<select>';
foreach ($options as $key => $value) {
echo '<option value="'.$key.'">'.$value.'</option>';
}
echo '</select>';
// 假設從數據庫中獲取選項列表
$options = array('1' => 'Option 1', '2' => 'Option 2', '3' => 'Option 3');
echo '<select>';
foreach ($options as $key => $value) {
echo '<option value="'.$key.'">'.$value.'</option>';
}
echo '</select>';