-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcustomers.php
104 lines (95 loc) · 2.67 KB
/
customers.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<?php
if(!isset($_POST['view_customer'])){
header("Location: index.html");
}
?>
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta http-equiv="X-UA-Compatible"
content="IE=edge" />
<meta name="viewport"
content="width=device-width, initial-scale=1.0" />
<link type="text/css" rel="stylesheet" href="style1.css?version=1.0">
<script src="https://kit.fontawesome.com/a076d05399.js"></script>
<title>Login</title>
</head>
<body>
<nav>
<div class="logo">SwiftBank</div>
<input type="checkbox" id="click">
<label for="click" class="menu-btn">
<i class="fas fa-bars"></i>
</label>
<ul>
<li><a href="index.html">Home</a></li>
<li><a>About</a></li>
<li><a>Services</a></li>
<li><a>Contact</a></li>
<li><a>Feedback</a></li>
</ul>
</nav>
<br>
<h1 id="heading">CUSTOMERS</h1><br>
<?php
$conn=new mysqli("localhost","root","","bank");
if($conn->connect_error){
?>
<p style="margin: 0 auto;text-align:center;"><span style="color:white;background-color: #CD5C5C;border-radius:6px;font-size:20px;letter-spacing: 3px;font-family:monospace;font-weight:600;">Failed to get data.</span></p>
<?php
}
else{
// echo "Successful";
$sql="select first_name,last_name,cid,phone from customer";
$result=$conn->query($sql);
if($result->num_rows>0){
?>
<div class="div2">
<table id="table1">
<thead>
<tr>
<th>Name</th>
<th>Customer_Id</th>
<th>Phone</th>
<th>Login As</th>
</tr>
</thead>
<tbody>
<?php
while($row = $result->fetch_assoc()) {
?>
<tr>
<form method="post" action="details.php?cid=<?php echo $row["cid"];?>">
<td><?php echo $row["first_name"]." ".$row["last_name"];?></td>
<td><?php echo $row["cid"];?></td>
<td><?php echo $row["phone"]?></td>
<td><input id="status" type="submit" name="login" value="LOGIN"/></td>
</form>
</tr>
<?php
}//while
?>
</tbody>
</table>
</div>
<br>
<?php
}//inner if
else{
?>
<p style="margin: 0 auto;text-align:center;"><span style="color:white;background-color: #CD5C5C;border-radius:6px;font-size:20px;letter-spacing: 3px;font-family:monospace;font-weight:600;">Failed to get data.</span></p>
<?php
}
}//outer else
?>
<script>
document.querySelector(".menu-btn").addEventListener("click",function(){
var checkBox = document.getElementById("click");
if(checkBox.checked==true)
document.getElementById("div2").style.display="block";
else
document.getElementById("div2").style.display="none";
})
</script>
</body>
</html>