我一直在看這個問題的不少問題,我仍然遇到問題。使用數組中的值填充HTML下拉框
下面是代碼:
<body>
<?php
//To start, there is a form with a dropbox and a button, which will have the various functions that can happe
?>
<form action="search_start.php" method="post">
Function <select name="Functions">
<?php
$fns_to_choose = array(
"Option 1" =>"Get A Monthly Report",
"Option 2" => "Track One Ship Over Time",
"Option 3" => "Track Multiple Ships Over Time",
"Option 4" => "Get Ships Over Time For One$
?>
<select>
<?php
foreach ($fns_to_choose as $key => $value) {
echo '<option value="' . $key . '">' . $value . '</option>';
}
?>
</select>
</form>
什麼情況是,代替使用的數組的元素來填充下拉列表中,所述元件只是「呼應」空下拉下方,它看起來像這樣:
從什麼我從本網站的其他答案中看到,選項應該填充表單,而不僅僅是在其下面。
任何建議絕對歡迎。
我覺得這就像是最基本的東西,我無法弄清楚。
事實上,我起身,走過來,回來,看到了問題。謝謝。 –