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 31 32 33 34 35
|
header('Content-type: text/html; charset=iso-8859-1');
// créer une session
session_start();
$categorie = $_POST['categorie'];
$url_categories = $_SERVER['DOCUMENT_ROOT'].'/xml/categories_'.$_SESSION['web_lang'].'.xml';
// charger le fichier des catégories et types
$xml_categories = simplexml_load_file($url_categories);
// lister les types
$table_types = array();
$table_types['id'] = array();
$table_types['intitule'] = array();
foreach($xml_categories->categorie[$categorie]->type as $item)
{
array_push($table_types['id'], utf8_decode($item['id']));
array_push($table_types['intitule'], mb_strtolower(utf8_decode($item)));
}
array_multisort($table_types['intitule']);
foreach($table_types['id'] as $id)
{
echo ' <option value="'.$id.'">'.$table_types['intitule'][$id].'</option>'."\n";
}
exit; |