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:
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 = '<select name="'.$name.'" >';
foreach( $schools as $s ){
$html .= '<option value="'. $s['id'] .'"';
if( $select == $s['name'] ){
$html .= 'selected="selected"';
}
$html .= '>'. $s['name'] . '</option>';
}
$html .= '</select>';
return $html;
}