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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
| <?php
require_once ('connexion.inc.php') ;
$connexion = new Connexion('localhost', 'a', 'a', 'a');
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
</head>
<body>
<?php
//echo "tester".$_POST["s_table"];
if($resultat = $connexion->select("SELECT * FROM projets")){
?>
<form action="" method="post" id="form1" onSubmit="location.href='choix_liste_deroulante.php'">
<table border=0 width=30% align=center>
<tr>
<td><strong>ID</strong></td>
<td>
<select name='s_table' style="width:180px" onchange="document.forms['form1'].submit();">
<option value="">Choisir votre table</option>
<?php
if($resultat = $connexion->select("SHOW TABLE STATUS")){
while ($ligne = mysql_fetch_row($resultat)) {
?>
<option value="<?php echo $ligne[0]?>"><?php echo $ligne[0]?></option>
<?php
}
}
?>
</select>
</td>
</tr>
<tr>
<td><strong>CHAMPS : </strong></td>
<td>
<select name='s_champ' style="width:180px">
<option value="">Choisir votre table -> champ</option>
<?php
if(isset($_POST["s_table"])){
$r_table = $_POST["s_table"];
if($resultat = $connexion->select("show columns from ".$r_table."")){
while ($ligne = mysql_fetch_row($resultat)) {
?>
<option value="<?php echo $ligne[0]?>"><?php echo $r_table." -> ".$ligne[0]?></option>
<?php
}
}
}
?>
</select>
</td>
</tr>
<tr>
<td colspan=2 align=center><br /><INPUT TYPE="SUBMIT" VALUE="envoyer"></td></td>
</tr>
</table>
</form>
<?php
}
?>
</body>
</html> |
Partager