-
Notifications
You must be signed in to change notification settings - Fork 1
/
teacher.php
214 lines (182 loc) · 5.59 KB
/
teacher.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
include("header.php");
include("db_con.php");
?>
<div class="container-fluid">
<div class="row" id="wrapper">
<?php require_once'menubar.php';?>
<div class="col-sm-12">
<div class="panel panel-default">
<div class="panel-body">
<form action="teacher.php" method="post" name="myForm" role="form">
<div class="form-group">
<h3>Click button to see all teachers of CSE-RU</h3>
<input type="submit" name="btn_submit" value="all teachers" class="btn btn-danger">
</div>
</form><br/>
<?php
error_reporting(E_ERROR||E_WARNING);
$ty=$_REQUEST['type'];
$op=mysqli_query($conn,"SELECT DISTINCT type FROM teachers");
?>
<form action="teacher.php" method="post" name="myForm" role="form">
<div class="form-group">
<label for="type">
Select Type:
</label>
<SELECT name="type" id="type" >
<option>Select One</option>
<?php
while ($t=mysqli_fetch_array($op)){
$type=$t['type'];
if(strcmp ($type,$ty) == 0){
$isSelected="selected";
}
else{
$isSelected="";
}
?>
<option value="<?php echo $type; ?>" <?=$isSelected; ?> ><?php echo $type; ?></option>
<?php } ?>
</SELECT><br/>
<input type="submit" name="submit" value="Search" class="btn btn-danger">
</div>
</form>
<?php
$st=$_REQUEST['status'];
$op1=mysqli_query($conn,"SELECT DISTINCT status FROM teachers");
?>
<form action="teacher.php" method="post" name="myForm" role="form">
<div class="form-group">
<label for="status">
Select Status:
</label>
<SELECT name="status" id="status" >
<option>Select One</option>
<?php
while ($s=mysqli_fetch_array($op1)){
$status=$s['status'];
print_r($s);
if(strcmp ($status,$st) == 0){
$isSelected="selected";
}
else{
$isSelected="";
}
?>
<option value="<?php echo $status; ?>" <?=$isSelected; ?> ><?php echo $status; ?></option>
<?php } ?>
</SELECT><br/>
<input type="submit" name="submit" value="Search" class="btn btn-danger">
</div>
</form>
<script language="javascript">
function Clickheretoprint()
{
var disp_setting="toolbar=yes,location=no,directories=yes,menubar=yes,";
disp_setting+="scrollbars=yes,width=400, height=400, left=100, top=25";
var content_vlue = document.getElementById("print_content").innerHTML;
var docprint=window.open("","",disp_setting);
docprint.document.open();
docprint.document.write('<html><head><title>Inel Power System</title>');
docprint.document.write('</head><body onLoad="self.print()" style="width: 400px; font-size:12px; font-family:arial;">');
docprint.document.write(content_vlue);
docprint.document.write('</body></html>');
docprint.document.close();
docprint.focus();
}
</script>
<div id="print_content">
<?php
if(isset($_POST['btn_submit'])){
$c2=mysqli_query($conn,"SELECT COUNT(*) FROM teachers");
while ($c2=mysqli_fetch_array($c2)) {
echo "<b>Total: </b><b style='color:#0B610B;'>".$c2['COUNT(*)']."</b>";
}
$result=mysqli_query($conn,"SELECT * FROM teachers");
while($row=mysqli_fetch_array($result)){
echo "<hr>";
echo "<div class='container-fluid' style='background-color:#D8D8D8;'>";
echo "<div class='row'>";
echo "<div class='col-md-6'>";
echo "<br/>";
echo "<b style='font-size:16px; color:#088A85;'>".$row['name']."</b><br/>";
echo "<b>".$row['type']."</b><br/>";
echo "</div>";
echo "<div class='col-md-6'>";
echo '<a href="teacherinfo.php?id=' . $row['t_id'] . '"><b class="btn btn-info">Details</b></a>' ;
echo "</div>";
echo "</div>";
echo "<br/>";
echo "</div>";
}
}
?>
<?php
//search by type
$ty=$_REQUEST['type'];
if($ty==true){
$c=mysqli_query($conn,"SELECT COUNT(*) FROM teachers WHERE type='$ty'");
while ($cp=mysqli_fetch_array($c)) {
echo "<b>Total: </b><b style='color:#0B610B;'>".$cp['COUNT(*)']."</b>";
}
if($ty!='Select One'){
$query=mysqli_query($conn,"SELECT * FROM teachers WHERE type='$ty'");
while($row=mysqli_fetch_array($query)){
echo "<hr>";
echo "<div class='container-fluid' style='background-color:#D8D8D8;'>";
echo "<div class='row'>";
echo "<div class='col-md-6'>";
echo "<br/>";
echo "<b style='font-size:16px; color:#088A85;'>".$row['name']."</b><br/>";
echo "<b>".$row['type']."</b><br/>";
echo "</div>";
echo "<div class='col-md-6'>";
echo '<a href="teacherinfo.php?id=' . $row['t_id'] . '"><b class="btn btn-info">Details</b></a>' ;
echo "</div>";
echo "</div>";
echo "<br/>";
echo "</div>";
}
}else {
echo "<i style='color:red;'>Select at least one Type</i>";
}
}else{
//search by status
$st=$_REQUEST['status'];
$c1=mysqli_query($conn,"SELECT COUNT(*) FROM teachers WHERE status='$st'");
while ($cp1=mysqli_fetch_array($c1)) {
echo "<b>Total: </b><b style='color:#0B610B;'>".$cp1['COUNT(*)']."</b>";
}
if($st!='Select One'){
$query=mysqli_query($conn,"SELECT * FROM teachers WHERE status='$st'");
while($row=mysqli_fetch_array($query)){
echo "<hr>";
echo "<div class='container-fluid' style='background-color:#D8D8D8;'>";
echo "<div class='row'>";
echo "<div class='col-md-6'>";
echo "<br/>";
echo "<b style='font-size:16px; color:#088A85;'>".$row['name']."</b><br/>";
echo "<b>".$row['type']."</b><br/>";
echo "</div>";
echo "<div class='col-md-6'>";
echo '<a href="teacherinfo.php?id=' . $row['t_id'] . '"><b class="btn btn-info">Details</b></a>' ;
echo "</div>";
echo "</div>";
echo "<br/>";
echo "</div>";
}
}else {
echo "<i style='color:red;'>Select at least one Status</i>";
}
}
?>
</div>
<div class="col-sm-12">
<a href="javascript:Clickheretoprint()" class="btn btn-info" style="float:right;">Print</a>
</div>
</div>
</div>
</div>
</div>
</div>