-
Notifications
You must be signed in to change notification settings - Fork 0
/
handle_class.php
175 lines (131 loc) · 3.52 KB
/
handle_class.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
<?php
include"database.php";
session_start();
if(!isset($_SESSION["TID"]))
{
echo"<script>window.open('teacher_login.php?mes=Access Denied...','_self');</script>";
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Tutor Joe's</title>
<link rel="stylesheet" type="text/css" href="css/style.css">
</head>
<body>
<?php include"navbar.php";?><br>
<div id="section">
<?php include"sidebar.php";?><br>
<h3 class="text">Welcome <?php echo $_SESSION["TNAME"]; ?></h3><br><hr><br>
<div class="content">
<h3>Add Classes</h3><br>
<div class="lbox1">
<?php
if(isset($_POST["submit"]))
{
$sq="insert into hclass(TID,CLA,SEC,SUB) values ('{$_SESSION["TID"]}','{$_POST["cla"]}','{$_POST["sec"]}','{$_POST["sub"]}')";
if($db->query($sq))
{
echo "<div class='success'>Insert Success..</div>";
}
else
{
echo "<div class='error'>Insert Failed..</div>";
}
}
?>
<form method="post" action="<?php echo $_SERVER["PHP_SELF"];?>">
<label>Class</label><br>
<select name="cla" required class="input3">
<?php
$sl="select DISTINCT(CNAME) from class";
$r=$db->query($sl);
if($r->num_rows>0)
{
echo "<option value=''>Select</option>";
while($ro=$r->fetch_assoc())
{
echo "<option value='{$ro["CNAME"]}'>{$ro["CNAME"]}</option>";
}
}
?>
</select>
<br><br>
<label>Section</label><br>
<select name="sec" required class="input3">
<?php
$sl="select DISTINCT(CSEC) from class";
$r=$db->query($sl);
if($r->num_rows>0)
{
echo "<option value=''>Select</option>";
while($ro=$r->fetch_assoc())
{
echo "<option value='{$ro["CSEC"]}'>{$ro["CSEC"]}</option>";
}
}
?>
</select><br></br>
<label>Subject</label><br>
<select name="sub" required class="input3">
<?php
$s="select * from sub";
$re=$db->query($s);
if($re->num_rows>0)
{
echo "<option value=''>Select</option>";
while($r=$re->fetch_assoc())
{
echo "<option value='{$r["SNAME"]}'>{$r["SNAME"]}</option>";
}
}
?>
</select>
<br><br>
<button type="submit" class="btn" name="submit">Add Details</button>
</form>
</div>
<div class="rbox1">
<h3> Details</h3><br>
<?php
if(isset($_GET["mes"]))
{
echo"<div class='error'>{$_GET["mes"]}</div>";
}
?>
<table border="1px" >
<tr>
<th>S.No</th>
<th>Class Name</th>
<th>Section</th>
<th>Subject</th>
<th>Delete</th>
</tr>
<?php
$s="select * from hclass";
$res=$db->query($s);
if($res->num_rows>0)
{
$i=0;
while($r=$res->fetch_assoc())
{
$i++;
echo"
<tr>
<td>{$i}</td>
<td>{$r["CLA"]}</td>
<td>{$r["SEC"]}</td>
<td>{$r["SUB"]}</td>
<td><a href='hclass.php?id={$r["HID"]}' class='btnr'>Delete</a></td>
</tr>
";
}
}
?>
</table>
</div>
</div>
</div>
<?php include"footer.php";?>
</body>
</html>