-
Notifications
You must be signed in to change notification settings - Fork 0
/
search.php
128 lines (123 loc) · 5.77 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
<?php
require_once './php/DBConnect.php';
$db->authRedirectLogin();
$title="Search";
include './layout/_header.php';
include './layout/navSec.php';
?>
<section style="min-height: 89vh;">
<div class="container">
<form action="" method="post">
<div class="row" style="padding-top: 15vh;">
<div class="col">
<label for="sexSelOpt">Looking For?</label>
<select class="form-select" id="sexSelOpt" name="gender" aria-label="Default select example">
<option selected value="women">Women</option>
<option value="men">Men</option>
</select>
</div>
<div class="col">
<div class="row">
<div class="col">
<label for="sexSelOpt">Age?</label>
<select class="form-select" id="sexSelOpt" name="ageFrom" aria-label="Default select example">
<option selected value="18">18</option>
<?=
$staringAge = 19;
$endAge = 40;
for ($x = $staringAge; $x <= $endAge; $x++) {
echo "<option value=".$x.">".$x."</option>";
}
?>
</select>
</div>
<div class="col">
<label>To</label>
<select class="form-select" id="sexSelOpt" name="ageTo" aria-label="Default select example">
<option selected value="40">40</option>
<?=
$staringAge = 19;
$endAge = 39;
for ($x = $endAge; $x >= $staringAge; $x--) {
echo "<option value=".$x.">".$x."</option>";
}
?>
</select>
</div>
</div>
</div>
</div>
</br>
<div class="row">
<div class="col">
<label for="sexSelOpt">Religion?</label>
<select class="form-select" id="sexSelOpt" name="religion" aria-label="Default select example">
<option selected value="hindu">Hindu</option>
<option value="muslim">Muslim</option>
</select>
</div>
<div class="col">
<label for="sexSelOpt">Mother Tongue?</label>
<select class="form-select" id="sexSelOpt" name="motherTongue" aria-label="Default select example">
<option selected value="hindi">Hindi</option>
<option value="marathi">Marathi</option>
<option value="bengali">Bengali</option>
<option value="gujarati">Gujarati</option>
<option value="english">English</option>
</select>
</div>
</div>
<div class="row mt-3">
<div class="col">
<button class="btn btn-outline-success" name="heroHomeSearchSubmitBtn" type="submit">Search</button>
</div>
</div>
</form>
</div>
<?php
if (isset($_POST['heroHomeSearchSubmitBtn'])) {
$searchRetVals = $db->searchPofile($_POST['gender'], $_POST['ageFrom'], $_POST['ageTo'], $_POST['religion'], $_POST['motherTongue']);
if(!$searchRetVals){
echo '
<div class="alert alert-warning">
<h1>No Result Found!</h1>
</div>
';
}else{
echo '
<div class="container" style="overflow-x: scroll;">
<table class="table table-bordered border-primary table-dark table-striped mt-5 pt-5">
<thead>
<tr>
<th scope="col">S.no</th>
<th scope="col">ProfilePic</th>
<th scope="col">Full Name</th>
<th scope="col">Last Update Profile</th>
</tr>
</thead>
<tbody>
';
for($i = 0; $i < count($searchRetVals); $i++){
echo '
<tr>
<th scope="row">'.($i+1).'</th>
<td>
<img style="height: 40px;width: 40px;" src="./assets/img/profiles/'.$searchRetVals[$i]['profile_img'].'" class="img-fluid rounded-start shadow-lg" alt="cuteCoupleImg">
</td>
<td><a href="./profile.php?id='.$searchRetVals[$i]['name'].'">'.$searchRetVals[$i]['name'].'</a></td>
<td>'.$searchRetVals[$i]['last_update_profile'].'</td>
</tr>
';
}
echo '
</tbody>
</table>
</div>
';
}
}
?>
</section>
<?php
include './layout/_footer.php';
?>