<?php $dbh = mysqli_connect("127.0.0.1", "world", "world", "world"); $result = $dbh->query('select distinct(Continent) as c from country'); ?> <form name="countrysearchform" id="countrysearchform" action="<?php echo $_SERVER['PHP_SELF'];?>" method="GET"> <select name="continent" id="continent"> <?php while ($row = $result->fetch_assoc()) { printf('<option value="%s">%s</option>', $row['c'], $row['c']); } $result->close(); ?> <br> <p><input type="submit" value="Search"></p> </select> </form>