-
Notifications
You must be signed in to change notification settings - Fork 0
/
fleaveactionaccept.php
44 lines (39 loc) · 1.24 KB
/
fleaveactionaccept.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
<!DOCTYPE html>
<html>
<body>
<?php
session_start();
?>
<div class ="message" style="float:right;margin-top: -10px;background-color: rgb(54, 216, 62); border:1px solid green;">
<?php
echo 'Welcome, ' .$_SESSION['fusername'] .'!';
?>
</div>
<?php
$fname=$_SESSION['fusername'];
$studentrollno=$_POST['studentrollno'];
$fromdate=$_POST['fromdate'];
$cname=$_POST['cname'];
$conn=mysql_connect("localhost","root","") or die("Could not connect!");
mysql_select_db("dbms") or die("Could not find db");
$que= mysql_query("SELECT * FROM leav WHERE fname='$fname' AND studentrollno='$studentrollno' AND cname='$cname'");
if (mysql_num_rows($que) > 0) {
while($row = mysql_fetch_assoc($que)) {
$accept="accepted";
$pending="pending";
$que= mysql_query("UPDATE leav SET status='$accept' WHERE fname='$fname' AND studentrollno='$studentrollno' AND cname='$cname' AND status='$pending' AND fromdate='$fromdate'");
$fromdate=$row['fromdate'];
$todate=$row['todate'];
?>
<script type="text/javascript">
alert("Request is Accepted Successfully!!!");
window.location.href="fleaverequests.php";
</script>
<?php
}
}else {
echo "error";
}
?>
</body>
</html>