I have a form that contains dynamically generated fields. There can be an arbitrary number of fields in the submitted form, depending on how many fields are added by the user. Here is a JSFIDDLE that you can refer to know what kind of fields i am generating dynamically. LINK TO JSFIDDLE
the only difference in this JSFIDDLE and my project is that instead of generating 2 dropdownsand 2 input fields in one set i am generating 3 dropdowns and 1 input fields in one set. number of sets that can be generated is maximum of 15 by now that the user can select from the dropdown in jsfiddle.
What is need to know is if a user generated 7 sets, how would i know the name of each field as i have to use PHP to process the data of this form and submit to a database.
have a look at this. It adds a variable to the end of each input, so you can keep track of the inputs.
Edit1: the names will be as such,
row1 – input1_1, input2_1, input3_1, input4_1
row2 – input1_2, input2_2, input3_2, input4_2 …and so on
Edit2: this jsfiddle removes the latest row(s) added.