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 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
|
elseif($_GET['id'] == 6)
{
$query ="SELECT idSection, nomSection, dureeSection from t_sections WHERE afficheSection = 1";
$result = mysql_query($query);
echo '<form method="POST">
<select name="champ" id="champ">
<option value=0 selected="selected">- Sélectionnez -</option>';
while($row = mysql_fetch_array($result))
{
?>
<option value="<?php echo $row['idSection']; ?>" <?php if(isset($_POST['champ']) && $_POST['champ'] == $row['idSection']) echo 'selected="selected"'; ?>><?php echo $row['nomSection'].'('.$row['dureeSection'].')'; ?></option>
<?php
}
echo '</select>
<div id="boton">
<input type="submit" name="select" value="Envoyer" />
</div>
<form>';
if (isset($_POST['select']))
{
if ($_POST['champ'] == 0)
{
echo '<div id ="m11">';
echo '<p>Veuillez sélectionner une formation !</p>';
echo '</div>';
}
else
{
$query = "SELECT udUnite, nomUnite, periodesUnite FROM t_unites WHERE sectionId = '".$_POST['champ']."'";
$result = mysql_query($query);
$sum1 = 0;
$testrow =0;
if (mysql_num_rows($result)==0)
{
echo '<div id ="m11">
<p>Section non active !</p>
</div>';
}
else
{
echo '<table>
<TH><a href="#?test=20">Unité</a></TH><TH><a href="index.php?id="21">Nom unité</a></TH><TH><a href="index.php?id="22">Périodes</a></TH>';
while($row = mysql_fetch_array($result))
{
echo '<tr><td>'.$row['udUnite'].'</td><td>'.$row['nomUnite'].'</td><td>'.$row['periodesUnite'].'</td></tr>';
$sum1++;
$testrow++;
}
$sql = "SELECT SUM(periodesUnite) AS nb_total FROM t_unites WHERE sectionId = '".$_POST['champ']."'";
$req = mysql_query($sql);
$sum2 = mysql_fetch_array($req);
if ($testrow == 0)
{
$sum2 = 0;
echo '<tr><td>Total = '.$sum1.'</td><td>'.$row['nomUnite'].'</td><td>Total = '.$sum2.'</td></tr>';
echo '</table>';
}
else
{
echo '<tr><td>Total = '.$sum1.'</td><td>'.$row['nomUnite'].'</td><td>Total = '.$sum2['nb_total'].'</td></tr>';
echo '</table>';
}
if (isset($_GET['test']))
{
if ($_GET['test'] == 20)
{
echo $_GET['test'];
}
}
}
}
}
} |
Partager