title: implode() [function.implode]: Invalid arguments passed WHEN $_POST['duration'] == EMPTY
body: <p>I have a multiselect field </p>
  
  <pre><code>&lt;select name="duration[]" id="duration" title="Duration" multiple="multiple" size="3"&gt;
  &lt;option value="1"&gt;1 Months&lt;/option&gt;
  &lt;option value="2"&gt;2 Months&lt;/option&gt;
  &lt;option value="3"&gt;3 Months&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>my php code implode multiple values i.e 123 as 1,2,3 and insert it in database. The problem is that the field is not a required field and when i leave it empty it give me error (Invalid arguments passed)</p>
  
  <p>My php code below</p>
  
  <pre><code>$duration = array();
  $duration = $_POST['duration'];
  if($duration)
     {
     foreach($duration as $value)
     {
     $months[] = $value;
     }
  }
  $sql = "SELECT * FROM tbl_courses WHERE duration IN (".implode($months, ',').") ";
  </code></pre>
  
  <p>thanks in advance</p>