User Tools

Site Tools


get-countries-by-continent
<?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>  
get-countries-by-continent.txt · Last modified: 2016/05/10 15:59 by mh