为什么我的选择选项之一在表单提交时没有在查询字符串中放置任何内容?
这是我的 HTML:
<select name="results">
<option value="0">Vis alle</option>
<option value="10">10 resultater per side</option>
<option value="20">20 resultater per side</option>
<option value="30">30 resultater per side</option>
<option value="40">40 resultater per side</option>
<option value="50">50 resultater per side</option>
<option value="75">75 resultater per side</option>
<option value="100">100 resultater per side</option>
</select>
当选择最上面的选项并提交表单时,获取变量“结果”将从 URL 中消失。我尝试用字符串“*”和“x”替换 0,但没有成功。
This is my HTML:
<select name="results">
<option value="0">Vis alle</option>
<option value="10">10 resultater per side</option>
<option value="20">20 resultater per side</option>
<option value="30">30 resultater per side</option>
<option value="40">40 resultater per side</option>
<option value="50">50 resultater per side</option>
<option value="75">75 resultater per side</option>
<option value="100">100 resultater per side</option>
</select>
When the topmost option is selected and form submitted, the get variable "results" disappears from the URL. I've tried switching out the 0 with strings "*" and "x" to no avail.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
零值将被解释为“无”,因此从 $_GET 中消失。但对于你的情况来说这应该没有问题。您也可以只测试数组中的“结果”,以检查是否有人想查看所有结果。或者将零更改为字符串“all”并进行测试。
A value of zero will get interpreted as "nothing" and therefore disappear from your $_GET. But that should be no problem in your case. You could also just test of the "results" is in the array to check if someone wants to see all. Or you change the zero to the string "all" and test for that.
你正在这样尝试吗?如果是的话,那么它似乎适用于我的本地。
Are you trying like this? If yes then it seems to work on my local.