PageRenderTime 8ms CodeModel.GetById 1ms app.highlight 2ms RepoModel.GetById 2ms app.codeStats 0ms

/gespac/gestion_inventaire/chainage.php

http://gespac.googlecode.com/
PHP | 56 lines | 35 code | 18 blank | 3 comment | 1 complexity | 1abfe38e14dc4f7afce03435683590cc MD5 | raw file
 1<?PHP
 2
 3	header("Content-Type:text/html; charset=iso-8859-1" ); 	// r?gle le probl?me d'encodage des caract?res
 4	
 5	// lib
 6	include ('../includes.php');
 7	
 8	// cnx ? la base de données GESPAC
 9	$con_gespac	= new Sql ($host, $user, $pass, $gespac);
10?>
11
12	var mydiv = document.getElementById('<?PHP echo $_GET['div_id']; ?>');
13	var select_dst  = document.getElementById('<?PHP echo $_GET['id_to_modify']; ?>');
14	
15	// on vide la select box
16	while( select_dst.options.length > 0 ) select_dst.options[0] = null;
17	
18	select_dst.options[0] = new Option(">>> Choisir une valeur <<<", "");
19	
20
21	<?PHP
22
23		$select_value 	= str_replace("%20", " ", $_GET['value']);
24		$mydiv 			= $_GET['div_id'];
25		$select_dst 	= $_GET['id_to_modify'];
26		
27		$select_type 	= $_GET['type'];
28		$select_stype 	= $_GET['stype'];
29		$select_marque 	= $_GET['marque'];
30		
31		switch ( $select_dst ) {
32			case "stype" :
33				$req_chainage = $con_gespac->QueryRow ( "SELECT DISTINCT marque_stype FROM marques WHERE marque_type = '$select_value'" );
34				break;
35			case "marque" :
36				$req_chainage = $con_gespac->QueryRow ( "SELECT DISTINCT marque_marque FROM marques WHERE marque_type='$select_type' AND marque_stype = '$select_value'" );
37				break;
38			case "modele" :
39				$req_chainage = $con_gespac->QueryRow ( "SELECT DISTINCT marque_model FROM marques WHERE marque_type='$select_type' AND marque_stype = '$select_stype' AND marque_marque='$select_value' " );
40				break;
41		}
42
43		foreach ( $req_chainage as $record) { 
44			
45			$item = addslashes(utf8_decode($record[0])); 
46	?>
47	
48
49	
50		mydiv.style.display = '';
51		select_dst.options[select_dst.options.length] = new Option("<?PHP echo $item ?>", "<?PHP echo $item ?>");
52		
53	<?PHP
54		}
55	?>
56