-
Notifications
You must be signed in to change notification settings - Fork 8
/
student.php
215 lines (197 loc) · 5.23 KB
/
student.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
/**
* @System HP-pc Rax
* @author Rakshit shah <[email protected]>
* @copyright 2015-2017 |Rakshit shah
* @license http://rakshit.in/license/license.php | PHP License 3.0
* @version 1.1
* @since File available since Release 1.0.0
*/
session_start();
include("header.php");
include("conection.php");
include("modal.php");
if($_GET["view"] = "delete")
{
mysql_query('DELETE FROM studentdetails WHERE studid =$_GET["slid"]');
}
if(isset($_SESSION["userid"]))
{
if(isset($_GET["first"]))
{
}
else
{
$_GET["first"] =0;
$_GET["last"] = 10;
}
if(isset($_POST["button"]))
{
$result = mysql_query("SELECT * FROM studentdetails where courseid='$_POST[courseid]' && semester='$_POST[semester]'");
}
else
{
$result = mysql_query("SELECT * FROM studentdetails LIMIT $_GET[first] , $_GET[last]");
}
$result1= mysql_query("SELECT * FROM course LIMIT $_GET[first] , $_GET[last]");
?>
<section id="page">
<header id="pageheader" class="normalheader">
<h2 class="sitedescription">
</h2>
</header>
<section id="contents">
<article class="post">
<header class="postheader">
<h2>Student Details</h2>
<p>
<form method="post" action="">
<label for="textfield7"><strong>Course </strong></label>
<strong>
<select name="courseid" id="select2">
<option value=""> Select Course </option>
<?php
while($row1 = mysql_fetch_array($result1))
{
echo "<option value='$row1[courseid]'>$row1[coursekey]</option>";
}
?>
</select>
<label for="textfield8">Semester</label>
<select name="semester" id="select">
<option value=""> Select Semester </option>
<option value="1">First Semester</option>
<option value="2">Second Semester</option>
<option value="3">Third Semester</option>
<option value="4">Fourth Semester</option>
<option value="5">Fifth Semester</option>
<option value="6">Sixth Semester</option>
</select>
</strong>
<input type="submit" name="button" id="button" value="View Records" />
</form>
</p>
</header>
<section class="entry">
</section>
<section class="entry">
</section>
<section class="entry">
</section>
<section class="entry">
<?php
if(mysql_num_rows($result) >= 1)
{
?>
<table width="500" border="1">
<tr>
<td width="38"><strong>SL No.</strong></td>
<td width="73"><strong>ID</strong></td>
<td width="50"><strong>Name</strong></td>
<td width="56"><strong>Date of birth</strong></td>
<?php
if(isset($_SESSION["type"]) && $_SESSION["type"]== "admin")
// if($_SESSION["type"]=="admin")
{
?>
<td width="119"><strong>Action</strong></td>
<?php
}
?>
</tr>
<?php
$i =$_GET["first"]+1;
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td> " . $i . "</td>";
echo "<td> " . $row['studid'] . "</td>";
echo "<td> " . $row['studfname'] . " " . $row['studlname'] . "</td>";
echo "<td> " . $row['dob'] . "</td>";
if(isset($_SESSION["type"]) && $_SESSION["type"]== "admin")
// if($_SESSION["type"]=="admin")
{
echo "<td> <a href='viewrecords.php?slid=$row[studid]&view=studentdetails'><img src='images/view.png' width='32' height='32' /></a>
<a href='studentins.php?slid=$row[studid]&view=studentdetails'> <img src='images/edit.png' width='32' height='32' /></a>";
?>
<a href='student.php?slid=$row[studid]&view=delete'><img src='images/delete.png' width='32' height='32' onclick="return confirm('Are you sure??')"/></a></td>
<?php
}
echo "</tr> ";
$i++;
}
if(isset($_SESSION["type"]) && $_SESSION["type"]== "admin")
// if($_SESSION["type"]=="admin")
{
$first=$_GET["first"]-10;
$last= $_GET["last"]- 10;
?>
<tr>
<td><?php
if($first <0)
{
}
else
{ ?>
<a href="student.php?first=<?php echo $first; ?>&last=<?php echo $last; ?>">
<?php
}
?><img src="images/previous.png" alt="" width="32" height="32" /></td>
<td colspan="2"><a href="#" onClick="openstudent(); return false"><img src="images/add.png" alt="" width="32" height="32" /></a></td>
<?php
$first=$_GET["first"]+10;
$last = $_GET["last"]+ 10;
?>
<td><div align="right"><?php
if($first > mysql_num_rows($result))
{
}
else
{ ?>
<a href="student.php?first=<?php echo $first; ?>&last=<?php echo $last; ?>">
<?php
}
?><img src="images/next.png" alt="" width="32" height="32" /></div></td>
<td width="119" align="right"> </td>
</tr>
<?php
}
?>
</table>
<?php
}
else
{
echo "<h2>No Records Found...</h2>";
}
?>
<?php
if(isset($_SESSION["type"]) && $_SESSION["type"]== "admin")
// if($_SESSION["type"]=="admin")
{
?>
<p><a href="examview.php?first=<?php echo $first; ?>&last=<?php echo $last; ?>"><a href="#" onClick="openstudent(); return false"><strong>Add Students</strong></a></p>
<?php
}
?>
</section>
</article>
</section>
<?php
}
else
{
header("Location: admin.php");
}
if(isset($_SESSION["type"]) && $_SESSION["type"]== "admin")
// if($_SESSION["type"]=="admin")
{
include("adminmenu.php");
}
else
{
include("lecturemenu.php");
}
include("footer.php"); ?>