我正在使用this.form.submit((进行表单提交。我已经从下拉列表中选择了任何值,但它没有显示为已选择。这是我的密码。请帮忙。
<div class="select-dropdown">
<form action="<?= base_url() ?>current_tender_list" method="POST">
<select name ="tenders" onchange="this.form.submit()">
<option value="Archived">Archived Tenders</option>
<option value="Closed">Closed Tenders</option>
<option value="Current">Show Current Tenders</option>
</select>
</form>
</div>
您必须设置然后选择="选择";在HTML中。
试试这样的东西:
<div class="select-dropdown">
<form action="<?= base_url() ?>current_tender_list" method="POST">
<select name ="tenders" onchange="this.form.submit()">
<option <?php if( $result['tenders'] =='Archived'): ?> selected="selected"<?php endif; ?> value="Archived">Archived Tenders</option>
<option <?php if( $result['tenders'] =='Closed'): ?> selected="selected"<?php endif; ?> value="Closed">Closed Tenders</option>
<option <?php if( $result['tenders'] =='Current'): ?> selected="selected"<?php endif; ?> value="Current">Show Current Tenders</option>
</select>
</form>
</div>