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 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173
|
<form id="form1" name="form1" method="post">
<table width="20%" border="0" align="center">
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<td>Année</td>
<td>
<select name="c1" />>
<option value="">Faites un choix</option>
<?php
$requete='SELECT years FROM `years`';
$result=mysql_query($requete);
while ($ligne=mysql_fetch_array($result))
{
$selectionnée = ($ligne[0] == $_POST["c1"]) ? " SELECTED " : "";
echo "<option value='", addslashes ($ligne['years']), "' $selectionnée >", addslashes ($ligne['years']), '</option>';
}
?> </select>
</td>
<td> </td>
</tr>
<tr>
<td>Semestre</td>
<td><select name="c2">
<option value="">Faites un choix</option>
<?php
$requete='SELECT semester FROM `semester`';
$result=mysql_query($requete);
while ($ligne=mysql_fetch_array($result))
{
$selectionnée = ($ligne[0] == $_POST["c2"]) ? " SELECTED " : "";
echo "<option value='", addslashes ($ligne['semester']), "' $selectionnée >", addslashes ($ligne['semester']), '</option>';
}
?> </select>
<td> </td>
</tr>
<tr>
<td>Classe</td>
<td><select name="c3">
<option value="">Faites un choix</option>
<?php
$requete='SELECT classe FROM `classe`';
$result=mysql_query($requete);
while ($ligne=mysql_fetch_array($result))
{
$selectionnée = ($ligne[0] == $_POST["c3"]) ? " SELECTED " : "";
echo "<option value='", addslashes ($ligne['classe']), "' $selectionnée >", addslashes ($ligne['classe']), '</option>';
}
?> </select>
</td>
<td> </td>
</tr>
<tr>
<td>Matière</td>
<td><select name="c4">
<option value="">Faites un choix</option>
<?php
$requete='SELECT code, name FROM `course`';
$result=mysql_query($requete);
while ($ligne=mysql_fetch_array($result))
{
$selectionnée = ($ligne[0] == $_POST["c4"]) ? " SELECTED " : "";
echo "<option value='", addslashes ($ligne['code']), "' $selectionnée >", $ligne['name'], '</option>';
}
?> </select>
</td>
<td><input name="b2" type="submit" id="b2"></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
<table width="80%" border="2" align="center">
<tbody>
<tr>
<td><b>Code</b></td>
<td><b>Nom</b></td>
<td><b>Prénom</b></td>
<td><b>Adresse</b></td>
<td><b>CP</b></td>
<td><b>Ville</b></td>
<td><b>E-mail</b></td>
<td><b>G Niveau</b></td>
<td><b>Supprimer</b></td>
</tr>
<?php
if(isset ($_POST['b2']))
{
$dr=mysql_query("SELECT e.code, s.name, s.firstname, s.adresse, s.cp, s.city, s.email, e.niveauG, r.semester, r.classe, r.year, e.course FROM entry e, registration r, student s WHERE s.code = r.student AND r.code = e.registration and r.semester='".addslashes ($_POST['c2'])."' and r.year='".addslashes ($_POST['c1'])."' and r.classe='".addslashes ($_POST['c3'])."' and e.course='".addslashes ($_POST['c4'])."'");
}
if (isset ($_POST['submit']))
{
$dr=mysql_query("DELETE FROM entry where code='".addslashes ($_POST['submit'])."'");
$dr=mysql_query("SELECT e.code, s.name, s.firstname, s.adresse, s.cp, s.city, s.email, e.niveauG, r.semester, r.classe, r.year, e.course FROM entry e, registration r, student s WHERE s.code = r.student AND r.code = e.registration and r.semester='".addslashes ($_POST['c2'])."' and r.year='".addslashes ($_POST['c1'])."' and r.classe='".addslashes ($_POST['c3'])."' and e.course='".addslashes ($_POST['c4'])."'");
}
if(isset ($_POST['b3']))
{
foreach($_POST['code'] as $key => $value)
{
if(isset($_POST['chck'][$key]))
{
$dr=mysql_query("UPDATE entry SET niveauG='1' WHERE code ='".addslashes ($value)."'");
}
else
{
$dr=mysql_query("UPDATE entry SET niveauG='0' WHERE code ='".addslashes ($value)."'");
}
}
$dr=mysql_query("SELECT e.code, s.name, s.firstname, s.adresse, s.cp, s.city, s.email, e.niveauG, r.semester, r.classe, r.year, e.course FROM entry e, registration r, student s WHERE s.code = r.student AND r.code = e.registration and r.semester='".addslashes ($_POST['c2'])."' and r.year='".addslashes ($_POST['c1'])."' and r.classe='".addslashes ($_POST['c3'])."' and e.course='".addslashes ($_POST['c4'])."'");
}
if (isset ($_POST['b2']) OR isset ($_POST['submit']) OR isset ($_POST['b3']))
{
while($ligne=mysql_fetch_array($dr))
{
?>
<tr>
<td><?php echo addslashes ($ligne[0]); ?></td>
<input type="hidden" name="code[]" value="<?php echo $ligne[0]; ?>" >
<td><?php echo addslashes ($ligne[1]); ?></td>
<td><?php echo addslashes ($ligne[2]); ?></td>
<td><?php echo addslashes ($ligne[3]); ?></td>
<td><?php echo addslashes ($ligne[4]); ?></td>
<td><?php echo addslashes ($ligne[5]); ?></td>
<td><?php echo addslashes ($ligne[6]); ?></td>
<td> <input type="checkbox" name="chck[]" value="<?php echo $ligne[0]; ?>" <?php if ($ligne[7] == true) echo ' checked="checked"'; ?> ></td>
<td> <input type="image" name="submit" src="img/b_drop.png" value="<?php echo $ligne[0]; ?>" /></td>
</tr>
<?php
}}
?>
</tbody>
</table>
<table width="80%" border="0" align="center">
<tbody>
<tr>
<td> </td>
</tr>
<tr>
<td><?php if(isset ($_POST['b2']) OR isset ($_POST['b3'])OR isset ($_POST['submit'])){ ?><center><input name="b3" type="submit" value="Mettre à jour" id="b3"><?php } ?></center></td>
</tr>
</tbody>
</table>
</form> |
Partager