-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
66 lines (66 loc) · 1.98 KB
/
index.php
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
<?php
require_once("classes/ApplicationClass.php");
$Obj = new ApplicationClass();
$users = $Obj->fetchAll("users");
$num = count($users);
if(isset($_SESSION['message'])) {
$message = $_SESSION['message'];
unset($_SESSION['message']);
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>PHP CRUD APPLICATION </title>
<!--Bootstrap and jQuery (Optional)-->
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" rel="stylesheet">
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/js/bootstrap.min.js"></script>
</head>
<body class="container">
<?php require_once("includes/header.php"); ?>
<?php if(isset($message)) {
echo '
<div class="alert">
<button type="button" class="close" data-dismiss="alert">×</button>
<strong>'.$message.'!</strong>
</div>
';
}
?>
<br><p><a href="addUser.php">Add New User</a></p><br>
<?php
if($num<=0) echo '<h3>No User Added</h3><br>';
else {
?>
<table class="table table-bordered">
<tr>
<th>ID</th>
<th>Firstname</th>
<th>Lastname</th>
<th>DOB</th>
<th>Email</th>
<th colspan="2">Action</th>
</tr>
<?php
foreach($users as $user) {
?>
<tr>
<td><?php echo $user['userid']; ?></td>
<td><?php echo $user['firstname']; ?></td>
<td><?php echo $user['lastname']; ?></td>
<td><?php echo $user['dob']; ?></td>
<td><?php echo $user['email']; ?></td>
<td><a href="editUser.php?id=<?php echo $user['userid']; ?>" title="Edit User"><i class="icon-pencil"></i></a></td>
<td><a href="deleteUser.php?id=<?php echo $user['userid']; ?>" title="Delete User"><i class="icon-trash"></i></a></td>
</tr>
<?php
}
?>
<table>
<?php
} ?>
<br><p><a href="addUser.php">Add New User</a></p><br>
<?php require_once("includes/footer.php"); ?>
</body>
</html>