! " #$% " &' (!! )!!! ' *+, - -.! " #!"#$%&%'!(! $ # " &# % &'& &(& ) ) &'& " * + # ), ) - + &(&./ &'& ) ) "! 2 # " # + )$)*) ((34 # 56 "./ ** 2 " * $. '. 3+!4!56/./ ** 78#$#9 : '** **;4(;!4!8# %9!4! #! $) ) )$3((3 #)77"#"#7 + &2898&) ( 3((3: 3#" )$ ) ((3!(#" ;<-!**# ; ;=#8 >?" (#" 8 3#" sur 7 5/6/27 9:32
Shareplanet.de -File-Hoster der extra Klasse Speichere deine ganzen Daten Shareplanet.de Maarch: Ged php/mysql Solution complète d'archivage légal Open Source GPL www.maarch.org! " #$%" " )+ # " & & & & && & & Test Php Testez vos applications web avec simplicité et efficacité. www.quotium.com Pratique de Ruby on Rails L'ouvrage O'Reilly offert avec votre abonnement an au magazine www.linformaticien.com Inscrivez-vous sur Meetic Inscrivez-vous et chattez avec les nombreuses femmes de votre région www.meetic.fr?,# @ & &?, ) ) & ' ( 8 ;<-! + ",*@!@< <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML. Transitional//EN" "http://www.w3.org/tr/xhtml/dtd/xhtml-transitional.dtd"> <html xmlns="http://www.w3.org/999/xhtml"> <head> <title>test de select dynamiques</title> </head> <body> <h>test de select dynamiques</h> <form id="testform"> Choisissez une catégorie : <select id="liste_cat"> <option value=""></option> </select><br /> Choisissez une sous-catégorie : <select id="liste_souscat"> 2 sur 7 5/6/27 9:32
</select> </form> </body> -+ & &) " # id="liste_cat" ) " id="liste_souscat" @+ 9 $ 4 6 ) # // Configuration MySQL $host_db = "localhost"; $user_db = "root"; $password_db = "mot de passe "; $bdd_db = "test"; // connexion a la base de donnees et selection de la table $connect_db = mysql_connect($host_db,$user_db,$password_db); mysql_select_db($bdd_db,$connect_db); <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML. Transitional//EN" "http://www.w3.org/tr/xhtml/dtd/xhtml-transitional.dtd"> <html xmlns="http://www.w3.org/999/xhtml"> <head> <title>test de select dynamiques</title> </head> <body> <h>test de select dynamiques</h> <form id="testform"> Choisissez une catégorie : <select id="liste_cat"> <option value=""></option> $sql="select id_categorie, categorie FROM categories ORDER BY categorie ASC"; $req=mysql_query($sql) or die(mysql_error()); while($cat = mysql_fetch_array($req)) echo '<option value="'.$cat['id_categorie'].'">'. $cat['categorie']. '</option>'; </select><br /> Choisissez une sous-catégorie : <select id="liste_souscat"> </select> </form> </body> </html> 2 +8 " + ) $ 3 sur 7 5/6/27 9:32
) * + - ), " $ 3#" #"! < ) require_once("../xajax.inc.php"); ( ) A&7&+ 9 &**& function SelectSouscat($catid) $options=""; // créé un nouvel objet permettant d'envoyer une réponse au côté client $objresponse = new xajaxresponse(); // on selectionne les sous-catégorie en fonction de l'id de la catégorie mère $sql="select id,titre FROM souscategories WHERE id_cat_mere = '".$catid."'"; $req=mysql_query($sql); while ($souscat = mysql_fetch_array($req)) // on place toutes les sous-catégories dans des options valables pour la liste SELECT $options.= '<option value="'.$souscat['id'].'">'. $souscat['titre']. '</option>'; // l'ajax remplacera le innerhtml (html intérieur) de la liste_souscat pour y mettre $options $objresponse->addassign("liste_souscat","innerhtml",$options); // envoie la réponse en XML return $objresponse->getxml(); #"#" 8 B46 $xajax = new xajax(); 4 sur 7 5/6/27 9:32
// remarquez que l'on peut passer en mode debug en décommentant la ligne suivante //$xajax->debugon(); $xajax->registerfunction("selectsouscat"); $xajax->processrequests(); 9, C)DC7)D # "#"? &"#"E#& # 4 6 $xajax->printjavascript("../") ) $ 4 6 $&)&, &**& &"#"E& 3((39 & E& <select id="liste_cat" onchange="xajax_selectsouscat(this.value)"> 9+&) & 3#" ),)$A )"" # >! # 4"&() &6# @ # + ' ( @ # ",, + // Configuration MySQL $host_db = "localhost"; $user_db = "root"; $password_db = "mot de passe "; $bdd_db = "test"; // connexion a la base de donnees et selection de la table $connect_db = mysql_connect($host_db,$user_db,$password_db); mysql_select_db($bdd_db,$connect_db); require_once("../xajax.inc.php"); 5 sur 7 5/6/27 9:32
function SelectSouscat($catid) $options=""; // créé un nouvel objet permettant d'envoyer une réponse au côté client $objresponse = new xajaxresponse(); // on selectionne les sous-catégorie en fonction de l'id de la catégorie mère $sql="select id,titre FROM souscategories WHERE id_cat_mere = '".$catid."'"; $req=mysql_query($sql); while ($souscat = mysql_fetch_array($req)) // on place toutes les sous-catégories dans des options valables pour la liste SELECT $options.= '<option value="'.$souscat['id'].'">'.$souscat['titre'].'</option>'; // l'ajax remplacera le innerhtml (html intérieur) de la liste_souscat pour y mettre $options $objresponse->addassign("liste_souscat","innerhtml",$options); // envoie la réponse en XML return $objresponse->getxml(); $xajax = new xajax(); //$xajax->debugon(); $xajax->registerfunction("selectsouscat"); $xajax->processrequests(); <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML. Transitional//EN" "http://www.w3.org/tr/xhtml/dtd/xhtml-transitional.dtd"> <html xmlns="http://www.w3.org/999/xhtml"> <head> <title>test de select dynamiques</title> $xajax->printjavascript("../") </head> <body> <h>test de select dynamiques</h> <form id="testform"> Choisissez une catégorie : <select id="liste_cat" onchange="xajax_selectsouscat(this.value)"> <option value=""></option> $sql="select id_categorie, categorie FROM categories ORDER BY categorie ASC"; $req=mysql_query($sql) or die(mysql_error()); while($cat = mysql_fetch_array($req)) echo '<option value="'.$cat['id_categorie'].'">'. $cat['categorie']. '</option>'; </select><br /> Choisissez une sous-catégorie : <select id="liste_souscat"> </select> </form> </body> </html> ' + " 4 6 (#", $ + + ;<-! ) (#FGHIFHHG!FJ.G <!!!+ + B (3*'&*!'3<&'3* <'&:3' <*<<&='3* '3:33!'3**3!'!*3* :3:'* <(3<&<* >"3* 6 sur 7 5/6/27 9:32
%!,"!--%!-!.--!..- -. / - $/.223-22456!!!(!- 6 $!,.7". 7 sur 7 5/6/27 9:32