<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
       "http://www.w3.org/TR/html4/loose.dtd">
<?php
require_once('mysql.inc.php');
echo "<head>";
echo "<title>Suchen einer Haltestelle anhand der Eingabe eines Buchstaben</title>";
echo "<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>";
echo "</head>";
echo "<body>";
echo "<h2>Suchen einer Haltestelle anhand der Eingabe eines Buchstaben</h2>
Bitte geben Sie mindestens einen Buchstaben ein";
echo "<form action='' method='post'>";
echo "<input name='a'>";
echo "<input type='submit' value='OK'>";
echo "</form>";
if (array_key_exists('a',$_POST)) {
$a = $_POST['a'];
$query="
SELECT name 
FROM stations
WHERE name LIKE  '". mysqli_real_escape_string($dz, $a) ."%' ";
$result=mysqli_query($dz, $query);
} else {
	$a ='';
}
if ($a != "") {
  if ($result) {
  echo "<p><span>Die m&ouml;glichen Haltestellen:";
  echo "</span><p>";
  $rows=mysqli_num_rows($result);
  $cols=mysqli_num_fields($result);
  for ($r=0; $r<$rows; $r++){
    for ($c=0; $c<$cols; $c++){
	  echo mysqli_result($result, $r, $c);
      echo "<br>";
      }
    }
      echo "</p>";
  }
  } 
echo "</body>";
?>
