我在这里得到了这段代码......
<form action="InvoiceNotice.php?action=invoicenotice" method="post">
<label for="fordays">Select Day</label>
<select name="daySelected" id="daySelected">
<option value="0">Today</option>
<?php
$array = array_combine(range(1,$InvoiceDaysArray['days']), range(1,$InvoiceDaysArray['days']));
foreach($array as $row => $value){
$selected = '';
$daySelected = 0;
if($daySelected == $row){
$selected = 'SELECTED';
}
echo "<option selected='" . $selected . "' value='" . $row . "'>" . $value . " days ago</option>";
}
?>
</select>
<input type="submit" name="button" id="button" value="Submit" />
</form>
我的问题是$selected
$daysSelected 变量来自已选择的内容。我想要做的是当用户选择一个选项时,该选项现在在下拉列表中被选中,并且在客户端点击提交后页面返回。
有人知道我在说什么吗?
谢谢