This commit is contained in:
2024-10-11 16:36:56 +02:00
parent 0e0e141982
commit a390944917
5 changed files with 115 additions and 68 deletions

View File

@@ -37,6 +37,7 @@ require_once('close.php');
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<link rel="stylesheet" href="style/style.css"/>
<title>Ajouter utilisateur</title> <title>Ajouter utilisateur</title>
</head> </head>
@@ -45,7 +46,7 @@ require_once('close.php');
<label for="login">Utilisateur</label> <label for="login">Utilisateur</label>
<input type="text" name="login" id="login"> <input type="text" name="login" id="login">
<label for="password">Mot de passe</label> <label for="password">Mot de passe</label>
<input type="text" name="password" , id="password" /> <input type="text" name="password" id="password" />
<label for="firstname">Prénom</label> <label for="firstname">Prénom</label>
<input type="text" name="firstname" id="firstname"> <input type="text" name="firstname" id="firstname">
<label for="lastname">Nom de famille</label> <label for="lastname">Nom de famille</label>
@@ -53,7 +54,7 @@ require_once('close.php');
<label for="role">Role</label> <label for="role">Role</label>
<input type="number" name="role" id="role"> <input type="number" name="role" id="role">
<label for="description">Description</label> <label for="description">Description</label>
<input type="text" name="description" id="description" /> <textarea name="description"></textarea>
<button>Enregistrer</button> <button>Enregistrer</button>
</form> </form>
</body> </body>

View File

@@ -27,20 +27,23 @@ require_once('close.php');
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Détails de l'utilisateur</title>
<title>Liste des produits</title> <link rel="stylesheet" href="style/style.css" />
</head> </head>
<body> <body>
<h1>Détails pour lutilisateur <?= $user['login'] ?></h1> <div>
<p>ID : <?= $user['id'] ?></p> <h1>Détails pour lutilisateur <?= $user['login'] ?></h1>
<p>Login : <?= $user['login'] ?></p> <p>ID : <?= $user['id'] ?></p>
<p>FirstName : <?= $user['firstname'] ?></p> <p>Login : <?= $user['login'] ?></p>
<p>LastName : <?= $user['lastname'] ?></p> <p>FirstName : <?= $user['firstname'] ?></p>
<p>Role : <?= $user['role'] ?></p> <p>LastName : <?= $user['lastname'] ?></p>
<p><a href="edit.php?id=<?= $user['id'] ?>">Modifier</a> <p>Role : <?= $user['role'] ?></p>
<a href="delete.php?id=<?= $user['id'] ?>">Supprimer</a> <p>
</p> <button onclick="window.location.href='edit.php?id=<?= $user['id'] ?>'">Modifier</button>
<button onclick="window.location.href='delete.php?id=<?= $user['id'] ?>'">Supprimer</button>
</p>
</div>
</body> </body>
</html> </html>

View File

@@ -38,36 +38,36 @@ require_once('close.php');
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Liste des produits</title> <title>Modification de l'utilisateur</title>
<link rel="stylesheet" <link rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" href="style/style.css">
integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh"
crossorigin="anonymous">
</head> </head>
<body> <body>
<h1>Modifier un utilisateur</h1> <div>
<form method="post"> <h1>Modifier un utilisateur</h1>
<p> <form method="post">
<label for="login">Login</label> <p>
<input type="text" name="login" id="login" value="<?= $result['login'] <label for="login">Login</label>
?>"> <input type="text" name="login" id="login" value="<?= $result['login']
</p> ?>">
<p> </p>
<label for="description">Description</label> <p>
<input type="text" name="description" id="description" value="<?= <label for="description">Description</label>
$result['description'] ?>"> <input type="text" name="description" id="description" value="<?=
</p> $result['description'] ?>">
<p> </p>
<label for="role">Role</label> <p>
<input type="number" name="role" id="role" value="<?= $result['role'] <label for="role">Role</label>
?>"> <input type="number" name="role" id="role" value="<?= $result['role']
</p> ?>">
<p> </p>
<button>Enregistrer</button> <p>
</p> <button>Enregistrer</button>
<input type="hidden" name="id" value="<?= $result['id'] ?>"> </p>
</form> <input type="hidden" name="id" value="<?= $result['id'] ?>">
</form>
</div>
</body> </body>
</html> </html>

View File

@@ -16,40 +16,46 @@ require_once('close.php');
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<link rel="stylesheet" href="style/style.css" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Liste des utilisateurs</title> <title>Liste des utilisateurs</title>
</head> </head>
<body> <body>
<h1>Liste des utilisateurs</h1> <div>
<table> <h1>Liste des utilisateurs</h1>
<thead> <table>
<th>ID</th> <thead>
<th>Login</th> <th>ID</th>
<th>Nom</th> <th>Login</th>
<th>Prenom</th> <th>Nom</th>
<th>Rôle</th> <th>Prenom</th>
</thead> <th>Rôle</th>
<tbody> <th>Actions</th>
<?php </thead>
foreach ($result as $user) { <tbody>
?> <?php
<tr> foreach ($result as $user) {
<td><?= $user['id'] ?></td> ?>
<td><?= $user['login'] ?></td> <tr>
<td><?= $user['firstname'] ?></td> <td><?= $user['id'] ?></td>
<td><?= $user['lastname'] ?></td> <td><?= $user['login'] ?></td>
<td><?= $user['role'] ?></td> <td><?= $user['firstname'] ?></td>
<td><a href="details.php?id=<?= $user['id'] ?>">Voir</a> <a <td><?= $user['lastname'] ?></td>
href="edit.php?id=<?= $user['id'] ?>">Modifier</a> <a href="delete.php?id=<?= <td><?= $user['role'] ?></td>
$user['id'] ?>">Supprimer</a></td> <td>
</tr> <button onclick="window.location.href='details.php?id=<?= $user['id'] ?>'">Voir</button>
<?php <button onclick="window.location.href='edit.php?id=<?= $user['id'] ?>'">Modifier</button>
} <button onclick="window.location.href='delete.php?id=<?= $user['id'] ?>'">Supprimer</button>
?> </td>
</tbody> </tr>
</table> <?php
<a href="add.php">Ajouter</a> }
?>
</tbody>
</table>
<button onclick="window.location.href='add.php'">Ajouter</button>
</div>
</body> </body>
</html> </html>

37
crud/style/style.css Normal file
View File

@@ -0,0 +1,37 @@
table {
width: 100%;
margin: auto;
line-height: 2em;
}
table tr td {
border-style: solid;
border-color: black;
border-width: 0.1em;
text-align: center;
padding: 2px;
}
th {
background-color: gray;
}
table tr:nth-child(even) {
background-color: darkgray;
}
button {
font-size: 1em;
}
body {
display: flex;
align-items: center;
justify-content: space-around;
}
div {
background-color: lightgray;
padding: 10px;
text-align: center;
}