【发布时间】:2018-03-16 21:01:22
【问题描述】:
我有一个 html 选择,其中填充了来自使用 foreach 循环的查询的 DATA。它看起来像这样
$client = $wpdb->get_results("SELECT string FROM `file` WHERE
`code` = 002 AND `status` = 2");
echo 'Filter by client: ';
echo '<select name="client_list">';
foreach ($client as $key => $row) {
$value = $row->string;
echo
'<option value='.$value.'>'
.$value. '</option>';
}
$client = $_GET['client_list'];
echo '</select>';
它用作过滤器以根据所选选项值显示数据。它过滤的表看起来像这样
|client | file |
|------ |-------------------|
|client1 | file00000 |
|client2 | file00002 |
现在我想将 html 的第一个选项值(默认值)设为空。我该怎么做?
【问题讨论】:
标签: html html-select default-value