I have an index.php which calls the DB connection and populates the page. If a condition is met an include will be called upon with a dropdown list. I am unable to populate this dropdown, it gives me no error just a blank screen.
index.php:
<?php
require_once('db_connection.php');
if($_GET["cat"] === "contact"){
include ('includes/contact.php');
}
else{
include ('includes/route.php');
}
?>
contact.php:
<?php
$sql = "SELECT * FROM dropdown_town";
$result = $dbhandle->query($sql);
$town = $result->fetch_assoc();
while ($row = mysql_fetch_array($town)) {
echo "<option value='" . $row['zip'] . "'>" . $row['townname'] . " </option>";
}
?>
My DB has a table called dropdown_town with the columns ID, zip and townname I only posted the PHP code here as the rest of the page runs ok