-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathadvancedsearch.php
More file actions
110 lines (91 loc) · 3.46 KB
/
Copy pathadvancedsearch.php
File metadata and controls
110 lines (91 loc) · 3.46 KB
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
105
106
107
108
109
110
<!DOCTYPE html>
<?php
include_once 'C:\xampp\htdocs\CarRentalsYSTEM\once.php';
session_start();
$email = $_SESSION['email'];
$currentDate = date("Y-m-d");
?>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css">
<link href="advancedsearch.css" rel="stylesheet">
<link rel="icon" href="https://cdn-icons-png.flaticon.com/512/809/809998.png" type="image/x-icon">
<title>Car Rental - Advanced Search</title>
<script src="https://kit.fontawesome.com/77fd9664d1.js" crossorigin="anonymous"></script>
</head>
<body>
<nav class ="navbar">
<div class="logo"><a href="welcome admin.php">Car Rental <i class="fas fa-car"></i></a></div>
<ul class="menu">
<li><a href="welcome admin.php">Home</a></li>
<li>
<a href="#">Account</a>
<ul class="dropdown">
<li><a href="index.php">Log out</a></li>
</ul>
</li>
<li><a href="#">About us</a></li>
</ul>
</nav>
<h1> Advanced Search </h1>
<?php
if ($_POST['search'] == 'car')
{
?>
<table>
<tr>
<th>Plate ID</th>
<th>Color</th>
<th>Year</th>
<th>Brand</th>
<th>Model</th>
<th>Office ID</th>
<th>Price/Day</th>
</tr>
<?php
$plateid = $_POST['advanced'];
$sql = "SELECT * FROM car WHERE Plate_id LIKE '%$plateid%' OR Brand LIKE '%$plateid%' OR Model LIKE '%$plateid%'
OR car.Year LIKE '%$plateid%' OR Color LIKE '%$plateid%' OR Price_per_day LIKE '%$plateid%' OR Office_id LIKE '%$plateid%'";
$result = $connect->query($sql);
while ($row = $result->fetch_assoc())
{
echo "<tr><td>" . $row["Plate_id"]. "</td><td>" . $row["Color"] . "</td><td>" . $row["Year"] . "</td><td>" . $row["Brand"] . "</td><td>"
. $row["Model"] . "</td><td>" . $row["Office_id"] . "</td><td>" . $row["Price_per_day"] . "</td><td>";
}
?>
</table>
<?php
}
elseif($_POST['search'] == 'customer')
{
?>
<table>
<tr>
<th>First Name</th>
<th>Last Name</th>
<th>Email</th>
<th>Phone</th>
<th>Country</th>
<th>Sex</th>
<th>National ID</th>
<th>Licence ID</th>
</tr>
<?php
$nationalid = $_POST['advanced'];
$sql = "SELECT * FROM customer WHERE national_id LIKE '%$nationalid%' OR Fname LIKE '%$nationalid%' OR Lname LIKE '%$nationalid%' OR Email LIKE '%$nationalid%'
OR Phone_number LIKE '%$nationalid%' OR Country LIKE '%$nationalid%' OR Sex LIKE '%$nationalid%' OR licence_id LIKE '%$nationalid%'";
$result = $connect->query($sql);
while ($row = $result->fetch_assoc())
{
echo "<tr><td>" . $row["Fname"] . "</td><td>" . $row["Lname"] . "</td><td>" . $row["Email"] . "</td><td>" . $row["phone_number"] . "</td><td>"
. $row["Country"] . "</td><td>" . $row["Sex"] . "</td><td>" . $row["national_id"] . "</td><td>" . $row["licence_id"] . "</td><td>";
}
}
?>
</table>
<footer>
<p><a href="">Contact us</a></p>
</footer>
</body>
</html>