title: Drupal 7 - Populate Drop Down select from DB in Form API
body: <p>I am still new to PHP, and even newer to Drupal's Form API. I'm simply trying to populate a drop down select from the database. I think the issue stems from my lack of a deep understanding of how to work with multidimensional arrays. Any help is sincerely appreciated.</p>
  
  <p>My code is currently:</p>
  
  <pre><code>    //Query DB for Rows
      $query = db_select('hp_education_years');
      $query-&gt;fields('hp_education_years', array('id', 'years',));
      $query-&gt;orderBy('years', 'ASC');
      $results = $query-&gt;execute();
  
      //define rows
      $options = array();
      foreach ($results as $result) {
          $options[$result-&gt;id] = array(
              $result-&gt;years,
          );
      }
      $form['education']['year'] = array(
          '#type' =&gt; 'select',
          '#title' =&gt; t('Year'),
          '#options' =&gt; $options,
          '#states' =&gt; array(
              'visible' =&gt; array(
                  ':input[name="data_set"]' =&gt; array('value' =&gt; 'education'),
              ),
          ),
      );
  </code></pre>
  
  <p>This returned a populated list, but displays the year's ID in bold as well as the year (2008 for example).</p>
  
  <p>How can I get the dropdown just to display the year, not the year ID in bold, and then the year. It seems like $option is just a level higher than I want it to be? if that makes sense?</p>
  
  <p>Many thanks in advance.</p>