title: How do you create a form dropdown from a database table in php?
body: <p>I am trying to code a function which creates a dropdown of school names selected from a database. It is doing fine creating a dropdown but it is not putting anything in the dropdown. Here is the code:</p>
  
  <pre><code>function schoolDD($name, $selected){
     $select = '';
     if( $selected != null )
     {
        $select = $selected;
     }
  
       $qry = "select *   
               from   school
               order by name, id
               where display = 'Y'";
  
       $schools = _execQry($qry);
  
  
     $html = '&lt;select name="'.$name.'" &gt;';
  
     foreach( $schools as $s ){
        $html .= '&lt;option value="'. $s['id'] .'"';
        if( $select == $s['name'] ){
           $html .= 'selected="selected"';
        }
        $html .= '&gt;'. $s['name'] . '&lt;/option&gt;';
  
     }
     $html .= '&lt;/select&gt;';
     return $html;
  }
  </code></pre>