-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
79 lines (72 loc) · 3.75 KB
/
index.php
File metadata and controls
79 lines (72 loc) · 3.75 KB
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
<?php
session_start();
require 'connection.php';
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>User Management</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-sRIl4kxILFvY47J16cr9ZwB07vP4J8+LH7qKQnuqkuIAvNWLzeN8tE5YBujZqJLB" crossorigin="anonymous">
</head>
<body>
<?php include('navbar.php')?>
<div class="container mt-4">
<?php include("message.php") ?>
<div class="row">
<div class="col-md-12">
<div class="card">
<div class="card-header">
<h4> Users list
<a href="user-create.php" class="btn btn-primary float-end">Add user</a>
</h4>
</div>
<div class="card-body">
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th>Email</th>
<th>Date of Birth</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<?php
$sql = "SELECT * FROM usuarios";
$usuarios = mysqli_query($connection, $sql);
if(mysqli_num_rows($usuarios) > 0) {
foreach($usuarios as $usuario) {
?>
<tr>
<td><?= $usuario['id'] ?></td>
<td><?= $usuario['name'] ?></td>
<td><?= $usuario['user_email'] ?></td>
<td><?= $usuario['date_of_birth'] ?></td>
<td>
<a href="user-view.php?id=<?= $usuario['id'] ?>" class="btn btn-secondary btn-sn">Details</a>
<a href="user-edit.php?id=<?= $usuario['id'] ?>" class="btn btn-success btn-sn">Edit</a>
<form action="action.php" method="POST" class="d-inline">
<button onclick = "return confirm('Are you certain that you want to delete this user?')" type="submit" name="user_delete" value="<?= $usuario['id'] ?>" class="btn btn-danger btn-sn">Delete</button>
</form>
</td>
</tr>
<?php
}
} else {
echo "0 users found.";
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/js/bootstrap.bundle.min.js" integrity="sha384-FKyoEForCGlyvwx9Hj09JcYn3nv7wiPVlz7YYwJrWVcXK/BmnVDxM+D2scQbITxI" crossorigin="anonymous"></script>
</body>
</html>
<?php