forked from harrithha/AAIG-Portal
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfilter_view.php
More file actions
154 lines (120 loc) · 6.37 KB
/
filter_view.php
File metadata and controls
154 lines (120 loc) · 6.37 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
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
<?php
session_start();
if(!isset($_SESSION['logged_in__admin_name'])){
echo '<script type="text/javascript"> location.href = "admin_login.php" </script>';
}
$host = "localhost";
$username = "root";
$password = "";
$dbname = "hac";
$conn = new mysqli($host, $username, $password, $dbname);
$gender = $_POST['gender'];
$course = $_POST['course'];
?>
<?php include("sidebar_admin.php"); ?>
<!DOCTYPE html>
<html>
<head>
<title>FILTERED STUDENT VIEW</title>
<link rel="stylesheet" href="css/bootstrap.min.css">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.5.0/font/bootstrap-icons.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1">
<!--===============================================================================================-->
<link rel="icon" type="image/png" href="images_add/icons/favicon.ico"/>
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="vendor_add/bootstrap/css/bootstrap.min.css">
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="fonts_add/font-awesome-4.7.0/css/font-awesome.min.css">
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="fonts_add/iconic/css/material-design-iconic-font.min.css">
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="vendor_add/animate/animate.css">
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="vendor_add/css-hamburgers/hamburgers.min.css">
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="vendor_add/animsition/css/animsition.min.css">
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="vendor_add/select2/select2.min.css">
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="vendor_add/daterangepicker/daterangepicker.css">
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="vendor_add/noui/nouislider.min.css">
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="css_add/util.css">
<link rel="stylesheet" type="text/css" href="css_add/main.css">
</head>
<body>
<div class="container-contact100" style="background-image: url('images_add/bg-01.jpg');">
<div class="wrap-contact100">
<div>
<?php
if ($gender == "all" && $course == "all"){
echo '<script type="text/javascript"> location.href = "view_student_detail.php" </script>';
}
else if ($course == "all"){
$sql = "SELECT * FROM student where gender = '$gender'";
$result = $conn->query($sql);
echo '<h3 class="contact100-form-title" style="text-transform:uppercase;">'.$gender.'</h3>';
echo '<table class = "table table-hover"><thead class="table-dark"><tr><th scope="col">Roll no </th><th scope="col">Name </th><th scope="col">View Details</th></tr></thead><tbody>';
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
echo "<tr><td>" . $row["rollNo"]. "</td><td> ".$row["name"]. "</td>";
echo '<td><form action="student_detail.php" method="post"><button type="submit" class="btn btn-outline-primary" name="roll" value="'.$row["rollNo"].'">VIEW</button></form></td></tr>';
}
}
}
else if ($gender == "all"){
$sql = "SELECT * FROM student ";
$result = $conn->query($sql);
echo '<h3 class="contact100-form-title" style="text-transform:uppercase;"><center>'.$course.'</center></h3>';
echo '<table class = "table table-hover"><thead class="table-dark"><tr><th scope="col">Roll no </th><th scope="col">Name </th><th scope="col">View Details</th></tr></thead><tbody>';
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
$x = 0;
$str_arr = explode (",", $row['listOfCourses']);
foreach($str_arr as $value){
if ($value == $course){
$x = 1;
}
}
if ($x == 1){
$x = 0;
echo "<tr><td>" . $row["rollNo"]. "</td><td> ".$row["name"]. "</td>";
echo '<td><form action="student_detail.php" method="post"><button type="submit" class="btn btn-outline-primary" name="roll" value="'.$row["rollNo"].'">VIEW</button></form></td></tr>';
}
}
}
}
else {
$sql = "SELECT * FROM student ";
$result = $conn->query($sql);
echo '<h3 class="contact100-form-title" style="text-transform:uppercase;"><center>'.$course.' and '.$gender.'</center></h3>';
echo '<table class = "table table-hover"><thead class="table-dark"><tr><th scope="col">Roll no </th><th scope="col">Name </th><th scope="col">View Details</th></tr></thead><tbody>';
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
$x = 0;
$str_arr = explode (",", $row['listOfCourses']);
foreach($str_arr as $value){
if ($value == $course){
$x = 1;
}
}
if ($x == 1){
$x = 0;
if ($gender == $row['gender']){
echo "<tr><td>" . $row["rollNo"]. "</td><td> ".$row["name"]. "</td>";
echo '<td><form action="student_detail.php" method="post"><button type="submit" class="btn btn-outline-primary" name="roll" value="'.$row["rollNo"].'">VIEW</button></form></td></tr>';
}
}
}
}
}
?>
</div>
<br><form action="view_student_detail.php" method="post"><center><button type="submit" class="btn btn-dark">BACK</button></center></form><br>
</div>
</div>
</body>
</html>