-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathclients.php
71 lines (56 loc) · 1.94 KB
/
clients.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
67
68
69
70
71
<?php
session_start();
if (!$_SESSION['LoggedInUser']) {
header("Location: index.php");
}
include ('includes/connection.php');
$Query = "SELECT * FROM Clients";
$Result = mysqli_query($Connection, $Query);
if (isset($_GET['alert'])) {
if ($_GET['alert'] == 'Success') {
$AlertMsg = "<div class = 'alert alert-success'>New Client Added in Database.<a class='close' data-dismiss='alert'>×</a></div>";
}
elseif ($_GET['alert'] == 'UpdateSuccess') {
$AlertMsg = "<div class = 'alert alert-success'>Client Updated Successfully.<a class='close' data-dismiss='alert'>×</a></div>";
}
elseif ($_GET['alert'] == 'Deleted') {
$AlertMsg = "<div class = 'alert alert-success'>Client Deleted Successfully.<a class='close' data-dismiss='alert'>×</a></div>";
}
}
mysqli_close($Connection);
include ('includes/header.php');
?>
<h1>Client Address Book</h1>
<?php
echo $AlertMsg; ?>
<table class="table table-striped table-bordered">
<tr>
<th>Name</th>
<th>Email</th>
<th>Phone</th>
<th>Address</th>
<th>Company</th>
<th>Notes</th>
<th>Edit</th>
</tr>
<?php
if (mysqli_num_rows($Result) > 0) {
while ($Row = mysqli_fetch_assoc($Result)) {
echo "<tr>";
echo "<td>" . $Row['Name'] . "</td><td>" . $Row['Email'] . "</td><td>" . $Row['Phone'] . "</td><td>" . $Row['Address'] . "</td><td>" . $Row['Company'] . "</td><td>" . $Row['Notes'] . "</td>";
echo '<td><a href="edit.php?ID=' . $Row['ID'] . ' "type="button" class="btn btn-primary btn-sm"><i class="glyphicon glyphicon-edit"></i> </a></td>';
echo "</tr>";
}
}
else {
echo "<div class='alert alert-warning'>You have no Clients yet. </div>";
}
mysqli_close($Connection);
?>
<tr>
<td colspan="7"><div class="text-center"><a href="add.php" type="button" class="btn btn-sm btn-success"><span class="glyphicon glyphicon-plus"></span> Add Client</a></div></td>
</tr>
</table>
<?php
include ('includes/footer.php');
?>