title: pre-selected values for a dynamic drop-down box with multiple values
body: <p>I am trying to pre select values on my edit page in multiple drop down so once user click edit, can see already inserted values. Values are saved as comma separated in MySQL like "1,2,3,4,5"</p>
  
  <p>trying this solution but doesn't work :( , is there is any way that those vales will be pre selected? Please help</p>
  
  <pre><code>&lt;select name="w_owning_branches[]" size="10" id="w_owning_branches" multiple="multiple" required&gt;
  &lt;option value="" class="dropdown-option"&gt;  Select Owning Branch  &lt;/option&gt;
  &lt;?php do {
  
  $value = $row_branches['branch_id'];
  $name = $row_branches['name'];
  $selected = '1,2,3,4,5,6';
  
  echo "&lt;option value='$value'".(($selected == '$value') ? " selected='selected'":"")."&gt;$name&lt;/option&gt;";
  
  
  } while ($row_branches = mysql_fetch_assoc($branches)); ?&gt;
  &lt;/select&gt;
  </code></pre>