I have a form that dynamically adds inputs depending on a user-supplied number. The form is used for booking courses, and the user selects the number of attendees, with the form adding in inputs to read in their details.
The inputs are generated and named simply by inserting the count of a FOR loop into the relevant attributes:
var inputEl = $('<input type="text" class="text delegate" name="delegate_name_' + i + '" id="delegate-name-' + i + '" placeholder="Delegate Name ' + (i + 1) + '" /><input type="text" class="text delegate" name="delegate_email_' + i + '" id="delegate-email-' + i + '" placeholder="Delegate Email ' + (i + 1) + '" /><input type="text" class="text delegate" name="delegate_tel_' + i + '" id="delegate-tel-' + i + '" placeholder="Delegate Telephone ' + (i + 1) + '" />')
This is all fine and dandy and works fine. However, I am about to write the PHP for mailing the form, and the thought occurs to me that I don't know how to tell the mail script how many inputs it needs to read.
I assume it needs another FOR loop to run through and create the relevant e-mail entries, but my knowledge of PHP is limited. Any ideas?