I am creating a registration form. The form allows multiple (in theory, unlimited) registrants. So there is an "Add attendee" button, and clicking that button should create an additional copy of the different registration information (name, age, etc.)
I figured out how to dynamically add information to the page, based on
My problem is that the example on that page is just adding one text box. I have 7 fields, all with labels and various formatting information. So I didn't want to put all of that HTML code inside the main page - I wanted to abstract it into its own page and just include / call it.
My first attempt was with PHP, so I separated out the common code into its own PHP include file, and included it. That worked fine, except that I had no way to identify the ids / names of the fields - because the PHP of course is server-side, there was no way to pass in an incrementing counter to the included PHP file to output in the form names (first_name_1, first_name_2, etc.)
So at this point I'm kind of stuck - anyone have any thoughts?