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
   |  
 
<?                                                              
 
 echo "<b><p align = \"center\"><font face = \"comic sans ms\" color = \"green\" size = \"+1\">Liste des entretiens des cages de la base de données:</p></font>";
 echo "<br>";
 echo "<br>";
 echo "<font face = \"comic sans ms\">";
 
 
 
 
$db = mysql_connect('localhost', 'root', '');
mysql_select_db('bd2_rat',$db);
 
// si envoi de formulaire 
if(isset($_POST['sub_form'])) { 
 
 
   // si suppression 
   if($_POST['sub_form']=="supprimer") { 
 
      $sql = "DELETE FROM entretenir WHERE id_volontaire= ".$_POST['idV'] AND "'num_cage=".$_POST['num_cage']."";
      $res = mysql_query($sql) or die (mysql_error()); 
 
   // si modification 
   }elseif($_POST['sub_form']=="modifier") { 
 
      $sql = "UPDATE entretenir SET ". 
            "num_cage= ".    $_POST['num'].",". 
            "id_volontaire=".   $_POST['id'].",".
            "pseudo=".   $_POST['pseudo'].",".
            "date_entretien= '".  $_POST['date']."' ". 
            "WHERE id_volontaire= ".$_POST['idV'] AND "'num_cage=".$_POST['num_cage']."";
      $res = mysql_query($sql) or die (mysql_error());
   } 
 
}
 
// extraction des donnees 
$sql = "SELECT * FROM entretenir";
$res = mysql_query($sql) or die(mysql_error()); 
 
// formulaire
 
//echo "<form method=\"post\" action=\"{$_SERVER['PHP_SELF']}\">";
echo "<table border =\"0\" cellpadding=\"0\" cellspacing=\"1\" bordercolor=\"green\">\n";
echo "\t<tr>\n";
echo "\t\t<th>lundi</th>\n";
echo "\t\t<th>mardi</th>\n";
echo "\t\t<th>mercredi</th></tr>\n";
echo "\t<tr>";
echo "\t\t<td>Soin</th>\n";
echo "\t</tr>\n";
 
while($data = mysql_fetch_assoc($res)) {
 
   echo "<form method=\"post\" action=\"{$_SERVER['PHP_SELF']}\">\n"; 
   echo "\t<tr>\n"; 
   echo "<input type=\"hidden\" name=\"num_cage\" value=\"".$data['num_cage']."\" />\n";
   echo "<input type=\"hidden\" name=\"idV\" value=\"".$data['id_volontaire']."\" />\n";
   echo "\t\t<td><input type=\"text\" name=\"num\" value=\"".$data['num_cage']."\"  /></td>\n";
   echo "<td><input type=\"text\" name=\"pseudo\" value=\"".$data['pseudo']."\" /></td>\n";
  // echo "\t\t<td><input type=\"text\" name=\"id\" value=\"".$data['id_volontaire']."\" /></td>\n";
   //echo "\t\t<td><input type=\"text\" name=\"date\" value=\"".$data['date_entretien']."\" /></td>\n";
 
   echo "\t\t<td><input type=\"submit\" name=\"sub_form\" value=\"modifier\" /></td>\n"; 
   echo "\t\t<td><input type=\"submit\" name=\"sub_form\" value=\"supprimer\" /></td>\n";
   echo "\t</tr>\n"; 
   echo "</form>\n"; 
 
} 
echo "</table>\n";
echo"<br>";
echo "<center><i><a href = http://XXX/YYYY/PTI%201/selectionvolontaire2.htm>Informations consernant l'identifiant d'un volontaire</center></i></a><br>"; 
echo "<a href = http://XXX/YYYY/PTI%201/nouveauentretien.php>ajout nouveau entretien de cage</a>";
?> | 
Partager