<?php
$jahrgang=$_COOKIE["jahrgang"];
$hs=$_COOKIE["ck_hs"];

include("kurs/datenbankanbindung.php");     // f&uuml;gt die Datenbankanbindung ein: Sys:\php\includes\kurs\datenbankanbindung.php
$db = dbconnect();

##header("Content-Type: text/html;charset=utf-8");

if(isset($_GET['getWord']) && isset($_GET['letters'])){
       if(preg_match('/Firefox/',$_SERVER['HTTP_USER_AGENT'])){
	  $letters = mb_strtoupper($_GET['letters']);
	}else{
	  $letters = mb_strtoupper(utf8_encode($_GET['letters']));
        }
	
	#$letters = preg_replace("/[^a-z0-9 ]/si","",$letters);
	$res = $db->query("SELECT dst_id, name, bezeichnung
	                     FROM stan_dienststellen 
	                    WHERE (upper(name) like '%".$letters."%' 
	                       OR upper(bezeichnung) like '%".$letters."%')
	                    ORDER BY name") or die(mysql_error());
	#echo "1###select ID,textstelle Name from ajax_countries where textstelleName like '".$letters."%'|";
	while($inf = $res->fetch_array()){
	$name= "$inf[name] - $inf[bezeichnung] ($inf[dst_id])";
		echo $name."|";
	}	
}
?>
