[英]html form with get method is creating multiple query parameters for the same input array
Let's say I have this simple form:假设我有这个简单的形式:
<form action="/search/" method="get" role="search">
<input name="cars[]" value="saab">
<input name="cars[]" value="honda">
<input name="cars[]" value="toyota">
<input type="submit" value="submit">
</form>
After clicking submit I am being redirected to the search results page and the URL looks like this: https://example.com/search/?cars=saab%5B%5D&cars=honda%5B%5D&cars=toyota单击提交后,我被重定向到搜索结果页面,URL 如下所示: https://example.com/search/?cars=saab%5B%5D&cars=honda%5B%5D&cars=toyota
Questions:问题:
%5B%5D
added to the url and can I get rid of it?%5B%5D
添加到 url 中,我可以去掉它吗??cars=saab,honda,toyota
??cars=saab,honda,toyota
吗? Thanks谢谢
Each input must have a unique name, just change names.每个输入必须有一个唯一的名称,只需更改名称即可。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.