简体   繁体   English

GET / POST请求表单提交中缺少参数

[英]GET/POST requests missing parameters on form submit

This one is driving me crazy. 这使我发疯。 I've tried several different solutions to no avail. 我尝试了几种不同的解决方案都无济于事。 Basically what is happening is that, when I submit a form, the request is being sent with no parameters. 基本上发生的是,当我提交表单时,请求是不带任何参数发送的。 I've tried both POST and GET and have monitored the requests with Firebug. 我已经尝试了POST和GET并使用Firebug监视了请求。 Here's some sample code: 这是一些示例代码:

<form action="/year/" id="year-form" method="get">
    <select class="dropdown" id="year" onchange="this.form.submit()">
        <option value="all">All</option>
        <option value="2011">2011</option>
        <option value="2010">2010</option>
        <option value="2009">2009</option>
    </select> 
</form>

Perhaps I should note that this is on a WordPress based site and I am directing the request back to the page from which it came. 也许我应该注意,这是在基于WordPress的站点上,并且我将请求定向回它来自的页面。 Any insight on this would be greatly appreciated. 任何对此的见解将不胜感激。

It's not submitted because it is missing a name attribute: 由于缺少name属性,因此未提交:

<select class="dropdown" id="year" onchange="this.form.submit()" name="year">

So it has nothing to do with Wordpress. 因此,它与Wordpress无关。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM