【发布时间】:2021-07-29 03:03:12
【问题描述】:
我有一个带有 select 元素的简单 HTML 表单。目的是使用 Wordpress 的内置查询参数来允许用户对存档中的帖子进行排序。添加日期、标题等
<form action="" method="GET">
<label id="sortLabel" for="orderby">Sort Songs:</label>
<select name="orderby" id="sortbox">
<option disabled selected>Sort by:</option>
<option value="date&order=asc">Oldest First</option>
<option value="date&order=dsc">Newest First</option>
<option value="title&order=asc">Alphabetical (A-Z)</option>
<option value="title&order=dsc">Alphabetical (Z-A</option>
</select>
<input type="submit" value="Filter" />
</form>
option 值可以正常传递到 URL,但 URL 正在编码,导致 URL 如下所示:
www.example.com/songs/?orderby=date%26order%3Dasc
而不是这个:
www.example.com/songs/?orderby=date&order=asc
【问题讨论】:
-
感谢@JosefZ,我想我的问题是如何让浏览器为我执行此操作?