1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
<?php
header('Content-Type: text/xml;charset=utf-8');
echo(utf8_encode("<?xml version='1.0' encoding='UTF-8' ?><options>"));
if (isset($_GET['debut'])) {
$debut = utf8_decode($_GET['debut']);
} else {
$debut = "";
}
$debut = strtolower($debut);
include('db.php');
mysql_select_db($database_conn, $conn);
$verif_group = "SELECT DENUMIRE from bucstr";
$recordset = mysql_query($verif_group, $conn) or die(mysql_error());
while ($row = mysql_fetch_assoc($recordset)) {
$liste[] = $row['DENUMIRE'];
}
function generateOptions($debut,$liste) {
$MAX_RETURN = 20;
$i = 0;
foreach ($liste as $element) {
if ($i<$MAX_RETURN && substr($element, 0, strlen($debut))==$debut) {
echo(utf8_encode("<option>".$element."</option>"));
$i++;
}
}
}
generateOptions($debut,$liste);
echo("</options>");
?> |
Partager