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 66 67
| <?php
require('configuration.php');
?>
<form name='form1' action='affiche_site.php' method='post'>
<fieldset>
<legend> Information du Site </legend> <!-- Titre du fieldset -->
<label for="affiche_site">Sélectionner le site : </label><SELECT id="affiche_site" name="affiche_site">
<?php
if ($connection) {
echo "<br>Connection OK";
}
$req1 = "SELECT id_site, nom FROM site ";
$result1 = mysqli_query($connection, $req1);
while($ligne1 = mysqli_fetch_assoc($result1)){
echo '<option value="'.$ligne1['id_site'].'">'.$ligne1['nom']."</option>";
}
?>
</select><b>
<input type="submit" name="bouton" value="Choisir">
</form>
<?php
if(isset($_POST['bouton'])){?>
<form id="form2" action='affichage.php' method='POST'>
<br/><br/>
<label> Infrastructure : </label>
<SELECT id="affiche_infra" name="affiche_infra">
<?php
if ($connection) {
echo "<br>Connection OK";
}
$req1 = "SELECT infrastructure FROM infrastructure ";
$result1 = mysqli_query($connection, $req1);
while($ligne1 = mysqli_fetch_assoc($result1)){
echo '<option value="'.$ligne1['infrastructure'].'">'.$ligne1['infrastructure']."</option>";
}
?>
</select><b>
<input type="submit" name="bouton_infra" Value='Valider'>
<?php
if(isset($_POST['bouton_infra'])){
//recupere l'infra
$infra = $_POST['affiche_infra'];
$recherchesite = "SELECT nom FROM site WHERE infrastructure = '$infra'";
$reqrecherchesite= mysqli_query($base, $recherchersite);
$resultatRechercheSite = mysqli_fetch_array($reqrecherchesite);
$site = $resultatRechercheSite['nom'];
try{
$base = new PDO('mysql:host=127.0.0.1;dbname=auchan', 'root', '');
$base-> setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);
$AFFICHE = $base ->prepare("SELECT * FROM site where infrastructure = :infra AND nom = :site");
$AFFICHE = execute(array( 'infra' => $infra, 'site' => $site) or die (print_r($base->errorInfo())));
}
catch(Exception $e){
//Affiche la ligne où ce situe l'erreur
//Affiche l'erreur
die('<b>Exception à la ligne : '. $e->getLine() .':</b> erreur : '.$e->getMessage());
}
}
}
?>
</fieldset> |
Partager