title: Get values from multiple sets of multiple list box generated dynamically
body: <p>I have a form that dynamically add rows with form fields on my webpage. One row of form field consist of a textbox and a multiple select list. Tutorial source from here: <a href="http://viralpatel.net/blogs/2009/03/dynamically-add-remove-rows-in-html-table-using-javascript.html" rel="nofollow">http://viralpatel.net/blogs/2009/03/dynamically-add-remove-rows-in-html-table-using-javascript.html</a></p>
  
  <p>The code for my textbox is:</p>
  
  <pre><code>&lt;input type="textbox" name="name[]" id="name" size="20" maxlength="50" /&gt;
  </code></pre>
  
  <p>And the code for my multiple select list is:</p>
  
  <pre><code>&lt;select name="friend[]" multiple size="4" id="friend" style="width:150px" &gt;
  &lt;option value="none" selected="selected"&gt;None&lt;/option&gt;
  &lt;option value="sam"&gt;Sam&lt;/option&gt;
  &lt;option value="jenny"&gt;Jenny&lt;/option&gt;
  &lt;option value="bob"&gt;Bob&lt;/option&gt;
  &lt;option value="aaron"&gt;Aaron&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p><strong>I'm using Javascript to generate multiple rows of the two fields and all rows share the same name.</strong> I have no problems with getting the names for different rows as name[0] = name at first row, name[1] = name at second row, and so on.But I'm not able to tell how many did the users select from the multiple list box from each row. </p>
  
  <p>If the user selects "None" from the first row, selects "Sam and Bob" at second row and select "Aaron" only at third row, the friend array will show a linear result, where friend[0] = none, friend[1] = sam, friend[2] = bob, friend[3] = aaron.</p>
  
  <p>How can I tell what values the user selects for each multiple list box using HTML or PHP or Javascript?</p>
  
  <p>Thanks in advance!</p>