title: How insert multiple select values to database?
body: <p>I am trying to insert multiple select values to database.</p>
  
  <p>HTML</p>
  
  <pre><code>&lt;select style="width:175px" id="first" multiple="true"&gt;
      &lt;option value="1"&gt;1&lt;/option&gt;
      &lt;option value="2"&gt;2&lt;/option&gt; 
      &lt;option value="3"&gt;3&lt;/option&gt; 
      &lt;option value="4"&gt;4&lt;/option&gt; 
      &lt;option value="5"&gt;5&lt;/option&gt;        
  &lt;/select&gt;
  &lt;/div&gt;
  
  &lt;div class="mid"&gt;
  &lt;button type="button" class='add'&gt; &gt; &lt;/button&gt;
  &lt;button type="button" class='remove'&gt; &lt; &lt;/button&gt;
  &lt;button type="button" class='add-all'&gt; &gt;&gt;&gt; &lt;/button&gt;
  &lt;button type="button" class='remove-all'&gt; &lt;&lt;&lt; &lt;/button&gt;
  &lt;/div&gt;
  
  &lt;div class="end"&gt;
  &lt;select style="width:175px" id="second" name="second[]" multiple="true"&gt;
  &lt;/select&gt;
  &lt;/div&gt;
  
  &lt;div style="clear:both;"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>Javascript:</p>
  
  <pre><code>$('.add').click(function(){
  $('#first option:selected').appendTo('#second');
  });
  $('.remove').click(function(){
  $('#second option:selected').appendTo('#first');
  });
  $('.add-all').click(function(){
  $('#first option').appendTo('#second'); 
  });
  $('.remove-all').click(function(){
  $('#second option').appendTo('#first'); 
  });
  </code></pre>
  
  <p>PHP:(its only a small portion of the php code)</p>
  
  <pre><code>$formvars['second'] = $this-&gt;Sanitize($_POST['second']);
  $insert_query = 'insert into 'comments'(second) values ("' . $this-&gt;SanitizeForSQL($formvars['second']) . '",)';
  </code></pre>
  
  <p>Its inserting only the word "Array" into database. Any idea?</p>