title: MySQL PHP filter array so only non empty values are filled into a form select menu
body: <p>I believe its quite a trivial task but I couldn't figure it out yet.
  I have a mysql table with multiple rows and columns. Each column should be used as a category for a dropdown menu. However some of those columns are shorter than the other ones.
  I have it currently implemented like this:</p>
  
  <pre><code>&lt;select name="exhaust"&gt;
  &lt;option value="&lt;? echo "$exhaust"; ?&gt;" selected&gt;&lt;? echo "$exhaust"; ?&gt;&lt;/option&gt;
  &lt;?
  //connect to mysql
  mysql_connect(localhost,$username,$password);
  @mysql_select_db($database) or die( "Unable to select database"); 
  $query = "SELECT * FROM tuning_parts";  
  $query = mysql_query($query);
  //ausgabe
  while($db = mysql_fetch_array($query)){
  $phrase = "&lt;option value=\"".$db['exhaust']."\"&gt;".$db['exhaust']."&lt;/option&gt;";
  
   echo($phrase);
  
    };
    ?&gt;
  
  &lt;/select&gt; 
  </code></pre>
  
  <p>However, this give me sometimes very long dropdown lists with a lot of empty values. I've tried to play around with array_filter() but I always got empty results.</p>
  
  <p>I would like to filter out the empty fields so the dropdown menu only shows actual values.</p>