title: How to show selected items in multiple select Box
body: <p>This is my mutiple select drop down box in edit page. Problem here is that this shows only one selected items. It doesn't show all selected items in it. How can i correct this? </p>
  
  <pre><code>    &lt;?php
           $query="SELECT * FROM lab";
          $dropdown = "&lt;select name='labid[]' multiple='multiple'  style='height:80px;' size='5' id='lab'&gt;";
          //$dropdown .= "&lt;option value=''&gt;Select lab to assign &lt;/option&gt;";
          $result2 = mysql_query ($query);
          while($row2 = mysql_fetch_assoc($result2)) 
          {
  
    $dropdown .= "\r\n&lt;option value='{$row2['lab_id']}'";
              while($row1 = mysql_fetch_assoc($result1)) 
                {
                   if(($row1['lab_id'])==($row2['lab_id']))
                    {
                        $dropdown .=" selected='selected'";
                    }
               }
    $dropdown .= "&gt;{$row2['l_name']}&lt;/option&gt;";
          }
          $dropdown .= "\r\n&lt;/select&gt;";
          echo $dropdown;
         ?&gt;
  </code></pre>