简体   繁体   中英

Form 1 submit tells form 2 which inputs are selected

I want to specify, on clicking a submit button in the first form, which checkboxes and radios should be selected in form 2.

(These inputs do not exist in form 1, but I want to tell them what to do in form 2.)

The action is already set on form 1 to go to form 2, but how do I pass the information that certain checkboxes and radios should be highlighted on this new form? Where do I put that? Can I use GET or POST?

EDIT
On page 1 I have this form:

Choose a package (you can edit on the next page):
Package 1 CHOOSE
Package 2 CHOOSE
Package 3 CHOOSE

The user will select one of those, and the next page will show up with an options form. For example, if user selects Package 3:

(O)Option 1(Incl. in Package 3)
()Option 2
()Option 3

[] Addition 1
[x] Addition 2(Incl. in Package 3)
[x] Addition 3(Incl. in Package 3)
[] Addition 4

Since option 1 and Additions 2 and 3 are included in the previously selected Package 3, I want them to be selected on the new page. This is what I need to learn how to do. Should I be using jQuery or PHP? And how do I reference these values to check the inputs?

EDIT 2

Now I am trying to tie the event to the submit button on the first form. I am using Get so that the url will read "blahblah.com?page=this&choice=12&choice2=other" when it works correctly. I know this part of using Get. What else do I need to do? Like I said before, these variables don't exist in the first form, so there's nothing I can capture. So how can I tell the submit button what values to load on the new page? I have tried putting in the URL plus all the variables but that doesn't work. I'm obviously missing something somewhere. Can anyone tell me what else I need to do?

Help!!!

如果你有有限的复选框和单选按钮,并且你没有关于元素值的任何隐私,你可以使用GET,但如果控件更多或传输的数据是安全的或私有的,那么你应该使用POST或REQUEST ....然后使用GET,POST或REQUEST使用某种脚本语言在下一个表单上获取值。并根据该设置表单2控件值....

The decision about which elements should be available in form2 is something that PHP should be working out and then returning the correct version of form2,

#pseudocode
if (something was checked){
display_form2A();

}else{
display_form2B();

}

It sounds like to want to do a package of some sort, and from your description nothing major happens when you hit the server for the second form. With that in mind, a small amount of javascript ( with jQuery ) can do that job. http://jsfiddle.net/dLSjk/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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