forked from kavinotravi/DBMS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfaculty_leave_request.php
232 lines (212 loc) · 6.89 KB
/
faculty_leave_request.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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
<?php
$iid = "";
$iid=$_SESSION['unametxt'];
$sql_roll = mysqli_query($con, "SELECT fac_id, name FROM fac_table where user_id like '%$iid%'");
$data = mysqli_fetch_array($sql_roll);
$id = $data['fac_id'];
$name = $data['name'];
if(isset($_POST['btn_add'])){
$nature = $_POST["Nature_Leave"];
$reason = $_POST["reason"];
$start=$_POST['start_yy']."/".$_POST['start_mm']."/".$_POST['start_dd'];
$end=$_POST['end_yy']."/".$_POST['end_mm']."/".$_POST['end_dd'];
$insert_sql = mysqli_query($con, "INSERT INTO leave_applications VALUES('teacher', '$name', $id, '$nature', '$reason', '$start', '$end', 'W') ");
if($insert_sql=="true")
echo "<div style='background-color: white;padding: 20px;border: 1px solid black;margin-bottom: 25px;''>"
. "<span class='p_font'>"
. "Leave Request submitted successfully... !"
. "</span>"
. "</div>";
else
echo "Update Failed...! Try after some time";
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="css/style_entry.css" />
</head>
<body>
<div class="panel panel-default">
<div class="panel-heading"><h1><span class="glyphicon glyphicon-user"></span>Leave Application</h1></div>
<div class="panel-body">
<div class="container">
<p style="text-align:center;">Leave Application</p>
</div>
<div class="table_margin">
<table class="table table-bordered">
<thead>
<tr>
<th style="text-align: center;">S No.</th>
<th style="text-align: center;">Nature of Leave</th>
<th style="text-align: center;">Reason</th>
<th style="text-align: center;">Start Date</th>
<th style="text-align: center;">End Data</th>
<th style="text-align: center;">Status</th>
</tr>
</thead>
<?php $sql_reg=mysqli_query($con,"SELECT * FROM leave_applications where id=$id AND applicant_type = 'teacher' ");
$i=0;
while($row=mysqli_fetch_array($sql_reg)){
$i++;
?>
<tr>
<td><?php echo $i;?></td>
<td><?php echo $row['nature_leave'];?></td>
<td><?php echo $row['Reason'];?></td>
<td><?php echo $row['start_date'];?></td>
<td><?php echo $row['end_date'];?></td>
<td><?php echo $row['approval'];?></td>
</tr>
<?php
}
?>
</table>
<div class="container_form">
<form method="post">
<div class="information_container">
<table class = "table without borders">
<tr>
<td> Nature of Leave </td>
<td> <select name ="Nature_Leave" class="form-control">
<option name = "med"> Medical </option>
<option name = "cas"> Casual </option>
</select></td>
</tr>
<tr>
<td> Reason </td>
<td> <input type="text" name="reason" class="form-control"/> </td>
</tr>
<tr>
<td> Start Date </td>
<td> <div class="teacher_bday_box">
<div class="select_style">
<select name="start_yy">
<option>Year</option>
<?php
$sel="";
for($i=1985;$i<=2015;$i++){
if($i==$y){
$sel="selected='selected'";}
else
$sel="";
echo"<option value='$i' $sel>$i </option>";
}
?>
</select>
</div>
<div class="select_style">
<select name="start_mm">
<option>Month</option>
<?php
$sel="";
$mm=array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
$i=0;
foreach($mm as $mon){
$i++;
if($i==$m){
$sel=$sel="selected='selected'";}
else
$sel="";
echo"<option value='$i' $sel> $mon</option>";
}
?>
</select>
</div>
<div class="select_style">
<select name="start_dd">
<option>date</option>
<?php
$sel="";
for($i=1;$i<=31;$i++){
if($i==$d){
$sel=$sel="selected='selected'";}
else
$sel="";
?>
<option value="<?php echo $i ;?>"<?php echo $sel?> >
<?php
if($i<10)
echo"0"."$i" ;
else
echo"$i";
?>
</option>
<?php
}?>
</select>
</div>
</div> </td>
</tr>
<tr> <td> End Date </td>
<td> <div class="teacher_bday_box">
<div class="select_style">
<select name="end_yy">
<option>Year</option>
<?php
$sel="";
for($i=1985;$i<=2015;$i++){
if($i==$y){
$sel="selected='selected'";}
else
$sel="";
echo"<option value='$i' $sel>$i </option>";
}
?>
</select>
</div>
<div class="select_style">
<select name="end_mm">
<option>Month</option>
<?php
$sel="";
$mm=array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
$i=0;
foreach($mm as $mon){
$i++;
if($i==$m){
$sel=$sel="selected='selected'";}
else
$sel="";
echo"<option value='$i' $sel> $mon</option>";
}
?>
</select>
</div>
<div class="select_style">
<select name="end_dd">
<option>date</option>
<?php
$sel="";
for($i=1;$i<=31;$i++){
if($i==$d){
$sel=$sel="selected='selected'";}
else
$sel="";
?>
<option value="<?php echo $i ;?>"<?php echo $sel?> >
<?php
if($i<10)
echo"0"."$i" ;
else
echo"$i";
?>
</option>
<?php
}?>
</select>
</div>
</div> </td>
</tr>
</table>
<div class="teacher_btn_pos">
<input type="submit" name="btn_add" href="#" class="btn btn-primary btn-large" value="Apply for Leave" />
<input type="reset" href="#" class="btn btn-primary btn-large" value="Cancel" />
</div>
</div> </form>
</div>
</div>
</div>
</body>
</html>