-
Notifications
You must be signed in to change notification settings - Fork 0
/
searchCustomer.php
49 lines (44 loc) · 2.38 KB
/
searchCustomer.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
<!DOCTYPE html>
<html lang="en">
<head>
<!--This file is linked to header-navigation.php-->
<title>Search Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Author: May Phyu Sin Thant, Capital E-Commerce Website">
<section class = "container row" >
<!--Search Employees -->
<form id = "form " class = "form" action= "view-customer-mgmt.php" method = "POST" >
<div class = "input-group mb-3 ">
<a href = "add-customer.php" type="button" class = "btn btn-dark " >+ New Customer</a>
<input id = "searchCust" name = "searchCust" type = "text" class = "form-control " required placeholder = "Search Customers">
<select id = "fieldCust" name = "fieldCust" class = "form-control " required>
<option value = "0"> --- Choose Field ↓ ---</option>
<option value="customerName"> Search By Name </option>
<option value="address"> Search By Address </option>
<option value="region"> Search By Region </option>
</select>
<button class="btn btn-outline-dark" type="submit">Search</button>
</div>
</form>
</section>
<?php
error_reporting(0);
if(count($_POST)>0) {
$searchCust = $_POST['searchCust'];
//echo $searchEM;
//echo $_POST['fieldEM'];
if($_POST['fieldCust'] == 'customerName'){
$result = "SELECT * FROM customer WHERE customerName LIKE '%$searchCust%' ";
//echo "testing pass 1";
}if($_POST['fieldCust'] == 'address'){
$result = "SELECT * FROM customer WHERE `address` LIKE '%$searchCust%' ";
//echo "testing pass 2";
}if($_POST['fieldCust'] == 'level'){
$result = "SELECT * FROM region WHERE `region` LIKE '%$searchCust%' ";
//echo "testing pass 3";
}
$rows = $conn->query($result);
//echo "testing pass 5";
}
?>