-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearch.php
214 lines (201 loc) · 6.16 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
<?php
include("logic/connection.php");
include("logic/back.php");
$idd=$_SESSION['id'];
?>
<!DOCTYPE html>
<html lang="en">
<head>
<script type="text/javascript" src="jquery-1.6.4.min.js"></script>
<script>
function fun(a){
$('#deg').load('getdegree.php?a='+a).fadeIn('fast');
$('#searchdata').load('tblclg.php?clg='+a).fadeIn('fast');
if(a==''){
document.location.reload();
}
}
function fun2(deg,clg){
$('#crs').load('getcourse.php?clg='+clg+'°='+deg).fadeIn('fast');
$('#searchdata').load('tbldeg.php?deg='+deg+'&clg='+clg).fadeIn('fast');
if(deg==''){
document.location.reload();
}
}
function fun3(crs,clg,deg){
// alert(clg);
$('#searchdata').load('tblcrs.php?deg='+deg+'&clg='+clg+'&crs='+crs).fadeIn('fast');
if(crs==''){
document.location.reload();
}
}
function fun4(value){
$('#searchdata').load('searchdata.php?value='+value).fadeIn('fast');
if(value==''){
document.location.reload();
}
}
</script>
<link rel="stylesheet" href="css/index.css">
<link rel="stylesheet" href="css/degree.css">
<!-- fontawsome link -->
<script src="https://kit.fontawesome.com/dce4936410.js" crossorigin="anonymous"></script>
<!-- google font -->
<style>
@import url('https://fonts.googleapis.com/css2?family=Roboto+Slab&display=swap');
</style>
<title>Document</title>
</head>
<body>
<!-- this is header -->
<Header>
<div class="logo"><img src="assets/logo.jpg" alt="logo" ></div>
</header>
<!-- this is hello section -->
<section class="hello">
<h1>Search page</h1>
</section>
<?php
if($_SESSION['lvl']==0){
$query6=mysqli_query($con,"SELECT * FROM `college` ");
}else{
$query6=mysqli_query($con,"SELECT * FROM `college` where collegeid='$idd' ");
}
?>
<!-- this is hero section -->
<section class="degree-hero">
<!-- hero section part one -->
<div class="part-one">
<table border="1">
<tr>
<td>
<select name="clg" id="clg" onchange="fun(this.value)">
<?php if($_SESSION['lvl']==0){?>
<option value="">select college</option>
<?php
}
while($result6=mysqli_fetch_assoc($query6)){
$clgnm2=$result6['collegename'];
$clgid=$result6['collegeid'];
?>
<option value="<?php echo $clgid;?>"><?php echo $clgnm2;?></option>
<?php
}
?>
</select>
</td>
<td>
<div id='deg'>
<?php
if($_SESSION['lvl']==0){
?>
<select name="deg" id="deg">
<option value="">select degree</option>
</select>
<?php } else{?>
<!-- here start user -->
<select name="deg" id="deg"onchange="fun2(this.value,'<?php echo $clgid;?>')">
<option value="">select degree</option>
<?php
$query=mysqli_query($con,"SELECT Distinct degid FROM `deg_crs_clg` where clgid='$clgid'");
while($result=mysqli_fetch_assoc($query)){
$degid=$result['degid'];
?>
<option value="<?php echo $degid; ?>">
<?php
$query2=mysqli_query($con,"SELECT * FROM `degree` where degreeid='$degid'");
while($result2=mysqli_fetch_assoc($query2)){
$degnm=$result2['degreename'];
echo $degnm;
}?></option>
<?php
}
?>
</select>
<?php } ?>
<!-- here end user -->
</div>
</td>
<td><div class="crs" id="crs">
<select name="crs" id="crs">
<option value="">select course</option>
</select>
</div></td>
</tr>
</table>
<br>
<table>
<tr>
<form action="tblnm.php" method="post">
<td><input style="width:250px;" type="text" placeholder="search by name" name="value" autocomplete="off" onkeyup="fun4(this.value)"></td>
</form>
</tr>
</table>
<!-- hero section part two -->
<div class="part-two">
<div id="searchdata">
<table border="1">
<tr>
<td><b>sid</b></td>
<td><b>name</b></td>
<td><b>photo</b></td>
<td><b>number</b></td>
<td><b>degree</b></td>
<td><b>course</b></td>
<td><b>college</b></td>
</tr>
<tr>
<?php
if($_SESSION['lvl']==0){
$query=mysqli_query($con,"SELECT * FROM `student` ");
}else{
$query=mysqli_query($con,"SELECT * FROM `student` where college='$idd' ");
}
$total=mysqli_num_rows($query);
if($total!=0){
$f=0;
while($result=mysqli_fetch_assoc($query)){
$stud_id=$result['myid'];
$deg=$result['degree'];
$name=$result['name'];
$crs=$result['course'];
$clg=$result['college'];
$number=$result['number'];
$f++;
?>
<tr>
<td><?php echo $f;?></td>
<td><?php echo $name;?></td>
<td>
<a href="showpic.php?myid=<?php echo $stud_id;?>" target="#" title="Click to View Full"><img src="student/<?php echo $stud_id;?>/student_pic.png" style="height:70px;width:70px;" alt=""></a>
</td>
<td><?php echo $number;?></td>
<td><?php
$query2=mysqli_query($con,"SELECT * FROM `degree` where degreeid='$deg'");
while($result2=mysqli_fetch_assoc($query2)){
$degnm=$result2['degreename'];
}
echo $degnm; ?></td>
<td><?php $query3=mysqli_query($con,"SELECT * FROM `course` where courseid='$crs'");
while($result3=mysqli_fetch_assoc($query3)){
$crsnm=$result3['coursename'];
}
echo $crsnm; ?></td>
<td><?php $query4=mysqli_query($con,"SELECT * FROM `college` where collegeid='$clg'");
while($result4=mysqli_fetch_assoc($query4)){
$clgnm=$result4['collegename'];
}
echo $clgnm; ?></td>
<?php }}else{
?>
<td>there is no data</td>
<?php }?>
</tr>
</table>
</div>
</div>
</section>
<!-- this is footer section -->
<?php include("footer.php");?>
</body>
</html>