我一直在看这个问题的不少问题,我仍然遇到问题。使用数组中的值填充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>
什么情况是,代替使用的数组的元素来填充下拉列表中,所述元件只是“呼应”空下拉下方,它看起来像这样:
从什么我从本网站的其他答案中看到,选项应该填充表单,而不仅仅是在其下面。
任何建议绝对欢迎。
我觉得这就像是最基本的东西,我无法弄清楚。
事实上,我起身,走过来,回来,看到了问题。谢谢。 –