Imitate the public number backstage voting management function.
You can add multiple issues dynamically, each with two options under the default, or add multiple items on the fly. The dynamic add function has been implemented via JS, but the value of the problem option cannot be obtained in PHP, the HTML of the individual option is as follows
*
Because there are options under each question, you name="options[]"
won't know which problem that option belongs to.
How do I set input
the attributes of an element correctly? name
Reply content:
Imitate the public number backstage voting management function.
You can add multiple issues dynamically, each with two options under the default, or add multiple items on the fly. The dynamic add function has been implemented via JS, but the value of the problem option cannot be obtained in PHP, the HTML of the individual option is as follows
*
Because there are options under each question, you name="options[]"
won't know which problem that option belongs to.
How do I set input
the attributes of an element correctly? name
There are too many open source code to solve such a problem, the basic idea is to add a count of the current number of input, and then count+1 for the name array name= "options[" +count+ "]"
Post several existing open source code
http://jsfiddle.net/jaredwilli/tzpg4/4/
Http://bootsnipp.com/snippets/featured/dynamic-form-fields-add-amp-remove
问题1name="question[0]"选项name="answer[0][0]" name="answer[0][1]"问题2name="question[1]"选项name="answer[1][0]" name="answer[1][1]"
The code for the dynamic output problem segment is resolved by adding a hidden field to store the problem label. However, this is only an add-on phase, and later revisions can be more cumbersome. Thank you here.