-
Notifications
You must be signed in to change notification settings - Fork 0
/
search_customer.php
executable file
·89 lines (86 loc) · 3.29 KB
/
search_customer.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
<?php
include 'dbconnect.php';
$searchtext = $_GET['searchtext'];
$query = "SELECT * FROM Customer where Customer_FName like '%$searchtext%' or Customer_Lname like '%$searchtext%'
or Phone_Number like '%$searchtext%'";
$sql = $conn->query($query);
?>
<?php
if (empty($sql))
{
echo "<tbody><tr>No results</tr></tbody>";
} else { ?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Basic Bootstrap Template</title>
<link rel="stylesheet" type="text/css" href="bootstrap/css/bootstrap.min.css">
<!-- Optional Bootstrap theme -->
<link rel="stylesheet" href="bootstrap/css/bootstrap-theme.min.css">
<style type="text/css">
body{
padding-top: 70px;
}
</style>
</head>
<body>
<nav id="myNavbar" class="navbar navbar-default navbar-inverse navbar-fixed-top" role="navigation">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbarCollapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="home.php">Simple Beings</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="navbarCollapse">
<ul class="nav navbar-nav">
<li class="active"><a href="home.php">Home</a></li>
<li><a href="list.php">List</a></li>
<li>
<form class="navbar-form navbar-left" action='./search_customer.php' method='get'>
<div class="form-group">
<input type="text" class="form-control" name="searchtext" placeholder="Search">
</div>
<button type="submit" class="btn btn-default">Submit</button>
</form>
</li>
</ul>
</div>
</div>
</nav>
<div class="container">
<table class="table table-bordered table-hover">
<thead>
<tr>
<th>Id</th>
<th>First Name</th>
<th>Last Name</th>
<th>Phone No</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<?php
while ($row = $sql->fetch_assoc()){
echo "<tr class=\"bg-warning\">";
echo "<td>".$row['Customer_ID']."</td>";
echo "<td>".$row['Customer_FName']."</td>";
echo "<td>".$row['Customer_Lname']."</td>";
echo "<td>".$row['Phone_Number']."</td>";
echo "<td><a class='btn btn-primary glyphicon glyphicon-pencil' href=edit_customer.php?id=".$row['Customer_ID']. "></a> ";
echo "<a onclick=\"return confirm('Are you sure you wish to delete this Record?');\" class='btn btn-primary glyphicon glyphicon-trash' href=delete_customer.php?id=".$row['Customer_ID']."></a></td></tr>";
}
$conn->close();
?>
</tbody>
</table>
</div></html>
<?php } ?>