modificationstatut.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Modification statut entretien</title>
  5. <link href="custom.css" rel="stylesheet">
  6. <meta name="viewport" content="width=device-width">
  7. </head>
  8. <?php
  9. include("class/sqlconnect.php");
  10. ?>
  11. <body>
  12. <a href="index.php">Revenir à l'accueil</a><br><br>
  13. <form action="modificationstatut.php" method="post">
  14. <table>
  15. <tr>
  16. <td>
  17. <label for="entreprise">Entreprise</label>
  18. </td>
  19. <td>
  20. <select name="entreprise" id="entreprise">
  21. <?php
  22. $sql = "SELECT ID, NomSociete FROM Entreprise";
  23. $result = mysqli_query($conn, $sql);
  24. while($row = mysqli_fetch_assoc($result)){
  25. echo "<option value='" . $row['ID'] . "'>" . $row['NomSociete'] . "</option>";
  26. }
  27. ?>
  28. </select>
  29. </td>
  30. </tr>
  31. <tr>
  32. <td>
  33. <label for="statut">Statut d'entretien</label>
  34. </td>
  35. <td>
  36. <select name="statut" id="statut">
  37. <?php
  38. $sql = "SELECT ID, Statut FROM StatutEntretien";
  39. $result = mysqli_query($conn, $sql);
  40. while($row = mysqli_fetch_assoc($result)){
  41. echo "<option value='" . $row['ID'] . "'>" . $row['Statut'] . "</option>";
  42. }
  43. ?>
  44. </select>
  45. </td>
  46. </tr>
  47. </table>
  48. <br>
  49. <input type="submit" name="submit" value="Modifier statut">
  50. </form>
  51. <?php
  52. if(isset($_POST['submit'])){
  53. $entreprise = $_POST['entreprise'];
  54. $statut = $_POST['statut'];
  55. $sql = "UPDATE Entreprise SET StatutEntretien = '$statut' WHERE ID = '$entreprise'";
  56. $result = mysqli_query($conn, $sql);
  57. if($result){
  58. echo "Statut d'entretien mis à jour avec succès.";
  59. } else {
  60. echo "Erreur lors de la mise à jour du statut d'entretien : " . mysqli_error($conn);
  61. }
  62. }
  63. ?>
  64. </body>
  65. </html>