How to populate my select list with data from my database?

I want to populate my select list with local schools based on the postcode entered so far i can’t even populate the select list with any database.
[php]

<?php $conn = mysql_connect("localhost", "username", "password"); mysql_select_db("twa051", $conn) or die('Database not found ' .mysql_error()); if (isset($_POST['postcode'], $_POST['currentPrimary'])) { $error = array(); $postcode = $_POST['postcode']; $primary = $_POST['currentPrimary']; $query = "select * from `valid_postcodes` where `postcode` = '" . $postcode . "' "; /*this connects to the customer table and the input ID is given the value customerID in the customer table*/ $res = mysql_query($query) or die ("ERROR: sql = ".$query."
".mysql_error()); /* this array connects to the query and the table*/ $row = mysql_fetch_array($res); /*this array stores all the values from customerID*/ if($row['postcode'] != $postcode) { $error[] = 'This postcode is invalid'; } $sql=mysql_query("SELECT schoolID,name FROM school_info"); if(mysql_num_rows($sql)){ $select= ''; while($rs=mysql_fetch_array($sql)){ $select.=''.$rs['name'].''; } } $select.=''; echo $select; } ?>

Section A

Students Information

   

Student’s family name: 


Student's given name: 

          Sex: Male  
Female

DOB: - -

Students Address :                   

City:           PostCode: <?php if(!empty($error)) { foreach ($error as $errors) { echo '',$errors,'
';

}
}
?>

Name of parent/carer:

Contact Numbers

Work Number:               Home Number:

Mobile Number:

Student's current primary school: --> Select you Primary School <--

Declaration

I declare that the information provided in this Expression of Interest is, to the best of my knowledge and belief, accurate and complete. I recognise that, should statements in this application later prove to be false or misleading, any decision made as a result of this application may be reversed. I understand that any enrolments following this placement process will be subject to consideration and acceptance of an Application to Enrol in a NSW Government School.

Print Name:                                                                                    Date:

Sponsor our Newsletter | Privacy Policy | Terms of Service