-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstudents.php
More file actions
154 lines (143 loc) · 8.18 KB
/
students.php
File metadata and controls
154 lines (143 loc) · 8.18 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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
<title>Table - VAT</title>
<link rel="stylesheet" href="assets/bootstrap/css/bootstrap.min.css?h=a0979a25f35731ac26dac1c170def768">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.12.0/css/all.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="assets/fonts/fontawesome5-overrides.min.css?h=9db842b3dc3336737559eb4abc0f1b3d">
<script src='./assets./vendor/jquery/jquery-3.2.1.min.js'></script>
<link rel='stylesheet' href='./assets/css/style.css' />
</head>
<body id="page-top">
<div id="wrapper">
<?php
session_start();
include("conn.php");
include("navbar.php");
?>
<?php
if (!isset($_SESSION['username'])) {
header("location:login.php");
}
?>
<div class="container-fluid">
<?php
if (!isset($_GET['department'])) {
$dl = $_SESSION['username'] . "_departments";
$q = "SELECT codename FROM " . $dl . " ORDER BY ID ASC LIMIT 1";
$result = mysqli_query($conn, $q);
while ($row = mysqli_fetch_assoc($result)) {
echo "<script> location.href='students.php?department=" . $row['codename'] . "'</script>";
}
}
?>
<h3 class="text-dark mb-4">Students</h3>
<div class="card shadow">
<div class="card-header py-3">
<p class="text-primary m-0 font-weight-bold">Student Information</p>
</div>
<div class="card-body">
<div class="row">
<div class="col-md-4 col-sm-6 col-xs-6 ">
<?php
if (isset($_POST['show'])) {
$department = $_POST['department'];
echo "$department";
header("location: ./students.php?department=" . $department . "");
}
?>
<form method="post">
<select class="form-control form-control-sm custom-select custom-select-sm" name="department" required id="department">
<?php
$department = "";
if (isset($_GET['department'])) {
$department = $_GET['department'];
}
$dl = $_SESSION['username'] . "_departments";
$q = "SELECT codename FROM " . $dl;
$qq = mysqli_query($conn, $q);
if (mysqli_num_rows($qq) > 0) {
while ($row = mysqli_fetch_assoc($qq)) {
if ($row['codename'] == $department) {
echo "<option selected value=" . $row['codename'] . ">" . $row['codename'] . "</option>";
} else {
echo "<option value=" . $row['codename'] . ">" . $row['codename'] . "</option>";
}
}
}
?>
</select>
</div>
<div class=" col-sm-6 col-xs-6">
<input class="btn btn-sm btn-primary" type="submit" name="show" value="Show">
</div>
</form>
</div>
<div class="table-responsive table mt-2" id="dataTable" role="grid" aria-describedby="dataTable_info">
<table class="table my-0" id="dataTable">
<thead>
<tr>
<th>Name</th>
<th>ID</th>
<th>Age</th>
<th>Gender</th>
<th>Address</th>
</tr>
</thead>
<tbody>
<script>
function delete_it(e){
var r = confirm('Are you sure?');
if(r == true)
{
location.href = "./delete.php?department=" + e.id + "&id=" + e.name;
}
}
</script>
<?php
if (isset($_SESSION['username'])) {
if (isset($_GET['department'])) {
$department = $_GET['department'];
$cl = $_SESSION['username'] . "_" . $department . "_students";
$q = "SELECT name,collegeid, age, gender, address FROM " . $cl;
$qq = mysqli_query($conn, $q);
// <td>Computer Science</td>
// <td>Dr. Sunil Kumar Jangid</td>
// <td><a href="#" class="btn btn-success btn-sm">Edit</a></td>
if (mysqli_num_rows($qq) > 0) {
while ($row = mysqli_fetch_assoc($qq)) {
echo "<tr><td><a href=./profile.php?college=" . $_SESSION['username'] . "&department=" . $department . "&id=" . $row['collegeid'] . ">" . $row['name'] . "</a></td>
<td>" . $row['collegeid'] . "</td>
<td>" . $row['age'] . "</td>
<td>" . $row['gender'] . "</td>
<td>" . $row['address'] . "</td>
<td><a name='" . $row['collegeid'] . "' id = '". $_GET['department'] ."' onclick='delete_it(this)' class='btn btn-danger btn-sm delete_btn'>Delete</a></td></tr>";
}
} else {
echo "No Students Yet";
}
}
} else {
echo '<script type="text/javascript">location.href = "./login.php";</script>';
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div><a class="border rounded d-inline scroll-to-top" href="#page-top"><i class="fas fa-angle-up"></i></a>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.5.3/js/bootstrap.bundle.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.8.0/Chart.bundle.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.4.1/jquery.easing.js"></script>
<script src="assets/js/script.min.js?h=b86d882c5039df370319ea6ca19e5689"></script>
</body>
</html>