带有以前获取参数的HTML表单GET方法 [英] HTML Form GET method with previous get parameters

查看:112
本文介绍了带有以前获取参数的HTML表单GET方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在页面上使用get参数获取表单:

index.php?PageID = 12

然后我有一个多表单该页面在用户选择详细信息时构建页面细节。



我的问题是当表单发布Get时覆盖其他get参数。



我可以使用帖子,但是只能在提交下一个表单时删除帖子值; \\ b
$ b

这个想法就是这些表单建立一个地址;


  1. ?PageID = 12
  2. ?PageID = 12& Section = 48

  3. ?PageID = 12& Section = 48& Event = 1456

等等more items。



感谢您的帮助。

解决方案

使用 method = get 时,会忽略在 action 属性中指定的查询字符串参数。添加隐藏表单域等参数:

 < form action =index.phpmethod =get> 
< input type =hiddenname =PageIDvalue =12>
< input type =hiddenname =Sectionvalue =48>
< input type =hiddenname =Eventvalue =1456>
< / form>

您可以使用服务器端脚本或JavaScript将查询字符串参数添加为隐藏的表单字段。 / p>

I have a form on a page with get parameters:
index.php?PageID=12

I then have a multiple forms on that page which build up the page details as the user selects the details.

My problem is when the form is posted the Get overwrites other get parameters.

I can use post but then can only post the information back once as the post values are wiped when the next form is submitted;

the idea is the forms build up a address as such;

  1. ?PageID=12
  2. ?PageID=12&Section=48
  3. ?PageID=12&Section=48&Event=1456

and so on as the user selects more items.

Thanks for your help.

解决方案

For forms with method=get the query string parameters specified in action attribute are ignored. Add such parameters as hidden form fields:

<form action="index.php" method="get">
<input type="hidden" name="PageID"  value="12">
<input type="hidden" name="Section" value="48">
<input type="hidden" name="Event"   value="1456">
</form>

You can use server-side script or JavaScript to add the query string parameters as hidden form fields.

这篇关于带有以前获取参数的HTML表单GET方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆