title: Processing Dynamic forms on the Server Side
body: <p>I've seen a lot of questions around here about implementing dynamic forms in jQuery or other javascript libraries, and I think I managed to get up and running in setting up a dynamic form for my test purposes.</p>
  
  <p>My question is whats the best practice in naming my form fields and processing them on the server side.</p>
  
  <p>I am trying to implement a contact like form where the user can add multiple phone numbers (and types) as well as multiple addresses (and types) something similar to the code below, this is the code block that will be duplicated dynamically.</p>
  
  <pre><code>&lt;div id="phones"&gt;
  &lt;label&gt;Phone Number&lt;/label&gt;&lt;input type="text" name="phone1" value="" /&gt;
  &lt;label&gt;Type&lt;/label&gt;&lt;input type="text" name="type1" value="" /&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Then I will have a +/- link or button to add another phone or remove a phone. When I submit the form, whats the best way to handle the combo of name/type
  Should I have the names like indicated above with a postfix of an id like <strong>phone1 / type1</strong> or should I use the array naming like <strong>phone[] / type[]</strong> and match the pairs on the server according to the index.</p>
  
  <p>I am using java (not sure if it makes a difference if it is java or php or whatever) but what would be a best practice of doing this.</p>
  
  <p>Thanks</p>