-
Notifications
You must be signed in to change notification settings - Fork 0
/
search.php
227 lines (199 loc) · 10.9 KB
/
search.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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
<?php
include_once "connection.php";
if(isset($_POST['submit'])){
$search_value = $_POST['search'];
$delivery_type = $_POST['delivery_type'];
$search_price = $_POST['search_price'];
$property_type = $_POST['property_type'];
if(empty($search_value) or empty($search_price) or empty($delivery_type) or empty($property_type)){
header ("Location: index.php");
}
if($search_price == 1){
$query = "select * from properties where (property_title LIKE '%$search_value%' or property_details LIKE '%$search_value%' or property_address LIKE '%$search_value%' or property_type LIKE '%$search_value%') and (delivery_type = '$delivery_type') and (property_type = '$property_type') and (price >= 5000 and price <= 50000)";
}
elseif($search_price == 2){
$query = "select * from properties where (property_title LIKE '%$search_value%' or property_details LIKE '%$search_value%' or property_address LIKE '%$search_value%' or property_type LIKE '%$search_value%') and (delivery_type = '$delivery_type') and (property_type = '$property_type') and (price >= 50000 and price <= 100000)";
}
elseif($search_price == 3){
$query = "select * from properties where (property_title LIKE '%$search_value%' or property_details LIKE '%$search_value%' or property_address LIKE '%$search_value%' or property_type LIKE '%$search_value%') and (delivery_type = '$delivery_type') and (property_type = '$property_type') and (price >= 100000 and price <= 200000)";
}
elseif($search_price == 4){
$query = "select * from properties where (property_title LIKE '%$search_value%' or property_details LIKE '%$search_value%' or property_address LIKE '%$search_value%' or property_type LIKE '%$search_value%') and (delivery_type = '$delivery_type') and (property_type = '$property_type') and (price >= 200000)";
}
$result = mysqli_query($con, $query);
if(!$result){
echo "Error Found!!";
}
}
else {header ("Location: index.php"); }
?>
<!DOCTYPE html>
<html lang="en">
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<head>
<title>Search Result - Real Estate Management System</title>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="assets/bootstrap/css/bootstrap.css" />
<link rel="stylesheet" href="assets/style.css" />
<script src="assets/jquery-1.9.1.min.js"></script>
<script src="assets/bootstrap/js/bootstrap.js"></script>
<script src="assets/script.js"></script>
<!-- Owl stylesheet -->
<link rel="stylesheet" href="assets/owl-carousel/owl.carousel.css">
<link rel="stylesheet" href="assets/owl-carousel/owl.theme.css">
<script src="assets/owl-carousel/owl.carousel.js"></script>
<!-- Owl stylesheet -->
<!-- slitslider -->
<link rel="stylesheet" type="text/css" href="assets/slitslider/css/style.css" />
<link rel="stylesheet" type="text/css" href="assets/slitslider/css/custom.css" />
<script type="text/javascript" src="assets/slitslider/js/modernizr.custom.79639.js"></script>
<script type="text/javascript" src="assets/slitslider/js/jquery.ba-cond.min.js"></script>
<script type="text/javascript" src="assets/slitslider/js/jquery.slitslider.js"></script>
</head>
<body>
<?php include 'includes/header.php';?>
<!-- banner -->
<div class="inside-banner">
<div class="container">
<h2>Search Result:</h2>
</div>
</div>
<!-- banner -->
<div class="container">
<div class="properties-listing spacer">
<div class="row">
<div class="col-lg-3 col-sm-4 ">
<div class="search-form">
<h4><span class="glyphicon glyphicon-search"></span> Search for</h4>
<form action="search.php" method="post" name="search">
<input type="text" class="form-control" name="search" placeholder="Search of Properties">
<div class="row">
<div class="col-lg-5">
<select name="delivery_type" class="form-control">
<option value="Rent">Rent</option>
<option value="Sale">Sale</option>
</select>
</div>
<div class="col-lg-7">
<select name="search_price" class="form-control">
<option>Price</option>
<option value="1">$5000 - $50,000</option>
<option value="2">$50,000 - $100,000</option>
<option value="3">$100,000 - $200,000</option>
<option value="4">$200,000 - above</option>
</select>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<select name="property_type" class="form-control">
<option>Property Type</option>
<option value="Apartment">Apartment</option>
<option value="Building">Building</option>
<option value="Office-Space">Office-Space</option>
</select>
</div>
</div>
<button name="submit" class="btn btn-primary">Find Now</button>
</form>
</div>
</div>
<div class="col-lg-9 col-sm-8">
<div class="sortby clearfix">
<div class="pull-left result">Showing: Search Result </div>
<div class="pull-right">
</div>
</div>
<div class="row">
<!-- properties -->
<?php
while($property_result = mysqli_fetch_assoc($result)){
$id = $property_result['property_id'];
$property_title = $property_result['property_title'];
$delivery_type = $property_result['delivery_type'];
$availablility = $property_result['availablility'];
$price = $property_result['price'];
$property_img = $property_result['property_img'];
$bed_room = $property_result['bed_room'];
$liv_room = $property_result['liv_room'];
$parking = $property_result['parking'];
$kitchen = $property_result['kitchen'];
$utility = $property_result['utility'];
?>
<div class="col-lg-4 col-sm-6">
<div class="properties">
<div class="image-holder"><img src="<?php echo $property_img; ?>" class="img-responsive"
alt="properties">
<?php if($availablility == 0){ ?><div class="status sold">Available</div>
<?php } else { ?>
<div class="status new">Not Available</div>
<?php } ?>
</div>
<h4><a
href="property-detail.php?id=<?php echo $id; ?>"><?php echo $property_title; ?></a>
</h4>
<p class="price">Price: $<?php echo $price; ?></p>
<p class="price">Delivery Type: <?php echo $delivery_type; ?></p>
<p class="price">Utilities: <?php echo $utility; ?></p>
<div class="listing-detail">
<span data-toggle="tooltip" data-placement="bottom"
data-original-title="Bed Room"><?php echo $bed_room; ?></span>
<span data-toggle="tooltip" data-placement="bottom"
data-original-title="Living Room"><?php echo $liv_room; ?></span>
<span data-toggle="tooltip" data-placement="bottom"
data-original-title="Parking"><?php echo $parking; ?></span>
<span data-toggle="tooltip" data-placement="bottom"
data-original-title="Kitchen"><?php echo $kitchen; ?></span>
</div>
<a class="btn btn-primary" href="property-detail.php?id=<?php echo $id; ?>">View
Details</a>
</div>
</div>
<?php } ?>
<!-- properties -->
</div>
</div>
</div>
</div>
</div>
<?php include 'includes/footer.php';?>
<!-- Modal -->
<div id="loginpop" class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<div class="row">
<div class="col-sm-6 login">
<h4>Login</h4>
<form class="" role="form">
<div class="form-group">
<label class="sr-only" for="exampleInputEmail2">Email address</label>
<input type="email" class="form-control" id="exampleInputEmail2"
placeholder="Enter email">
</div>
<div class="form-group">
<label class="sr-only" for="exampleInputPassword2">Password</label>
<input type="password" class="form-control" id="exampleInputPassword2"
placeholder="Password">
</div>
<div class="checkbox">
<label>
<input type="checkbox"> Remember me
</label>
</div>
<button type="submit" class="btn btn-success">Sign in</button>
</form>
</div>
<div class="col-sm-6">
<h4>New User Sign Up</h4>
<p>Join today and get updated with all the properties deal happening around.</p>
<button type="submit" class="btn btn-info" onclick="window.location.href='register.html'">Join
Now</button>
</div>
</div>
</div>
</div>
</div>
<!-- /.modal -->
</body>
</html>