Have a form
<div class="customer">
<input type="text" name="customer" />
<input type="text" name="address" />
<select name="married">
<option value="0">No</option>
<option value="1">Yes</option>
</select>
</div>
Using jQuery, users can add as many customers as they like to the form. How do I keep each customer separated for validation and database purposes? I believe using an array field is the answer but I am concerned about empty values such as missing an address or failing to answer the “married” question.
Thanks.
You will have to append a
[]to all your fields, so in your case it will look like this:Then using a server side language like php you can parse the data like: