表单操作网址可以包含querystring值吗? [英] can a forms action url contain querystring values?
本文介绍了表单操作网址可以包含querystring值吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
表单操作网址可以包含查询字符串值吗?
can a forms action url contain querystring values?
推荐答案
是
可以.
method="get"
时,将删除查询字符串,并替换为表单输入名称/值(因为表单控件是构建GET
查询字符串的控件).
when method="get"
then the querystring will be stripped out and replaced by the form input names/values (since the form controls are those that build the GET
querystring).
<form method="get" action="?param=foo">
<input type="hidden" name="param" value="bar" />
</form>
将提交param=bar
要保留该值,应在form
上指定method="post"
.
To keep the value you should specify method="post"
on the form
.
<form method="post" action="?param=foo">
<input type="hidden" name="otherparam" value="bar" />
</form>
将提交param=foo&otherparam=bar
<form method="post" action="?param=foo">
<input type="hidden" name="param" value="bar" />
</form>
将提交param=foo¶m=bar
(因此,根据您处理请求的方式,您可能会获得数组值或意外结果).
will submit param=foo¶m=bar
(so, depending on how you process the request, you could get either an array value or unexpected results).
这篇关于表单操作网址可以包含querystring值吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文