this is a a page A.html
<form name=form>
<input type=text id = txtA>
</form>
when i load using jquery to B.html
i load multiple times.
<form name=form>
<input type=text id = txtA>
</form>
<form name=form>
<input type=text id = txtA>
</form>
<form name=form>
<input type=text id = txtA>
</form>
<form name=form>
<input type=text id = txtA>
</form>
How can i rename the form name to form1,form2,form3…formN
so i can get this
<form name=form1>
<input type=text id = txtA>
</form>
<form name=form2>
<input type=text id = txtA>
</form>
<form name=form3>
<input type=text id = txtA>
</form>
when i submit i want to use php to retrieve the data.
for each form
formi.txtA
this way i can get each form data uniquely.
This would rename all forms called
formand postfix an increasing number:When you load the forms one by one, you need a different approach:
For every time you add a new form, you call this:
Where
'#divid'is the jQuery selector for the parent node where your form is in.Update
It seems that you have multiple input fields that you dynamically load. Instead of loading a whole new form, just load the
<input />fragment.The server would then return a fragment:
This then gets inserted into one form, so you can submit it to PHP.