title: Sending Multiple select to server
body: <p>I am using a form with multiple selects (using Select2) and submitting the data to the server using HTML5's Formdata object. It works well when I am sending text or files but does not work in this case.</p>
  
  <p>I have given the name attribute as lbl[] as required and also specified multiple="multiple".</p>
  
  <p>Does Formdata support multiple select or is there anything I am missing?</p>
  
  <p>My select:</p>
  
  <pre><code>&lt;select class="form-control theread_p_ip" name="thread_p[]" multiple="multiple" style="width: 100%"&gt;&lt;/select&gt;
  </code></pre>
  
  <p>The way I am using Formdata:</p>
  
  <pre><code> form_data = new FormData($(mydata.sform)[0]);
   ajaxoptions.data=form_data;
  </code></pre>
  
  <p>where ajaxoptions is the object I am passing to JQuery AJAX and $(mydata.sform)[0] selects my form</p>
  
  <p>I have checked using <code>print_r($_POST,true)</code> and I get this:</p>
  
  <pre><code>Array
  (
  [thread_p] =&gt; 
  [thread_lbl] =&gt; giggg
  [ddemand] =&gt; json
  [dtype] =&gt; json
  [eltarget] =&gt; -1
  [sform] =&gt; #ta-tbxnewthread
  [mkey] =&gt; tbx_newthread
  )
  </code></pre>
  
  <p>You can see that the thread_p is empty. If I specify name="thread_p" instead of using [] I get the last selected value alone.</p>
  
  <p>PS: Ignore the other values in the array. Those are other parameters I am sending from the client side.</p>
  
  <p>And if you wonder there is no options in select, they are loaded via AJAX by select2 which is working properly.</p>
  
  <p><strong>UPDATE:</strong> SOLVED using hackerman's fiddle: <a href="https://jsfiddle.net/95khdzp2/1/" rel="nofollow">https://jsfiddle.net/95khdzp2/1/</a></p>
  
  <p>And in server side you get the values separated by ',' which you have to separate using <code>explode(',', $variable);</code> if you are using PHP</p>