Let's say I've got a form in which you can describe a family:
<input type="text" name="mother">
<input type="text" name="father">
<input type="text" name="child">
But I want people to be able to add an infinite number of children to the form. So I can use Javascript to simply continue adding new inputs for more children, but I wonder how I should name these. Do I simply do child1, child2, child3, etc.? And on the backend I simply loop over all the children?
And what if all children also need an "age" input field. Do I simply continue adding fields such as child1_age, child2_age, child3_age?
I guess this would work, but I have the feeling that there's a smarter way of this. Does anybody know of a better way to handle this? All tips are welcome!