-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcmhod-del-stud.php
127 lines (117 loc) · 3.03 KB
/
cmhod-del-stud.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
<?php
session_start();
$user = $_SESSION['user'];
$log = $_SESSION['cmhod'];
$msg="";
require "config/config.php";
if ($log != "log"){
header ("Location: index.php");
}
if(isset($_POST['submit'])){
$user = $_POST['user'];
$res = mysqli_query($db_handle,"SELECT * FROM users WHERE user='$user' AND branch='CM'");
if(mysqli_num_rows($res)<1)
{
$msg = "Student doesnt exist or not from CM.";
}
else{
if(mysqli_query($db_handle,"DELETE FROM users WHERE user='$user'")){
$msg = "Deleted sucessfully.";
}
else{
$msg = "Wrong Enrollment number.";
}
}
}
?>
<html>
<title>Delete Student</title>
<div class="wrapper">
<head>
<link href="css/mystyle.css" rel="stylesheet" type="text/css"/>
<table><tr><td><h1>Delete Student</h1></td>
<td width="1000px" align="right"><a href="logout.php" class="logout">Logout</a></td></tr></table>
<div id="cssmenu">
<ul>
<li><a href="cmhod.php">Home</a></li>
<li><a href="cmhod-add-cm.php">Add Student</a></li>
<li><a href="cmhod-del-stud.php">Delete Student</a></li>
<li><a href="cmhod-cm-result.php">See Result</a><li>
<li><a href="cmhod-stud-msg.php">Students Messages</a></li>
<li><a href="#">Profile</a>
<ul>
<li><a href="cmhod-changepass.php">Change Password</a></li>
</ul>
</li>
</ul>
</div>
<link rel="stylesheet" href="css/normalize.css"><br><br>
<style>
.wrapper {
display: flex;
align-items: center;
flex-direction: column;
width: 97%;
min-height: 97%;
padding: 20px;
background: rgba(4, 40, 68, 0.85);
color:white;
font-size: 14px;
}
form{
text-align: left;
align-items: center;
color:white;
}
input,select{
color: black;
}
.txt_fld{
padding:5px;
border:3px solid #09F;
border-radius:5px;
}
h1{color:#FFF;}
</style>
</head>
<body>
<link href="css/stud.css" rel="stylesheet" type="text/css"/>
<br><br>
<table class="reference" style="width:35%">
<form action="cmhod-del-stud.php" method="POST">
<tr>
<td>Enrollment No. </td>
<td> <input type="text" name="user" class="txt_fld" required ></td>
</tr>
<tr>
<td></td>
<td><input type="submit" value="Delete" class="logout" name="submit"></td>
</tr>
</form>
</table>
<br><br>
<?php if($msg){ echo "$msg"; } ?>
<table class="reference" style="width:40%">
<tr>
<th>No</th>
<th>Enrollment Number</th>
<th>Action</th>
</tr>
<?php
$SQL = "SELECT * FROM users WHERE branch='CM' AND user!='admin' AND user!='cmhod' AND user!='ifhod' ORDER BY user ASC ";
$result = mysqli_query($db_handle,$SQL);
$i = 1;
$j = 0;
while ($db_field = mysqli_fetch_assoc($result))
{
$user = $db_field['user'];
print("<tr><td align='center'><b>$i</b></td>");
print("<td align='center'>$user</td>");
$j = $i + 1;
print("<td align='center' width = '70px'><form action='cmhod-del-stud.php' method='POST'><input type='hidden' name='user' value=".$user."><input type='submit' name='submit' value='Delete'></form></tr>");
$i = $i + 1;
}
?>
</table>
</body>
</html>