-
Notifications
You must be signed in to change notification settings - Fork 1
/
totalsal.php
97 lines (89 loc) · 1.97 KB
/
totalsal.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
<?php
session_start();
if (!isset($_SESSION["manager"])) {
header('Location: index.php');
exit;
}
?>
<html>
<head><title>Total Salary Info.</title></head>
<center>
<h1>Salary Information</h1>
<hr>
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]) ?>" method="POST">
<table>
<tr>
<th>Select Month: </th>
<td>
<select name="month">
<option>January</option>
<option>February</option>
<option>March</option>
<option>April</option>
<option>May</option>
<option>June</option>
<option>July</option>
<option>August</option>
<option>September</option>
<option>October</option>
<option>November</option>
<option>December</option>
</select>
</td>
</tr>
<tr>
<th> </th>
<td><input type="submit" name="submit" value="Search" />
</td>
</tr>
</table>
</form>
</center>
</html>
<?php
if($_SERVER["REQUEST_METHOD"] == "POST")
{
$month = $_REQUEST['month'];
switch ($month)
{
case 'January': $monthNO = '01';
break;
case 'February': $monthNO = '02';
break;
case 'March': $monthNO = '03';
break;
case 'April': $monthNO = '04';
break;
case 'May': $monthNO = '05';
break;
case 'June': $monthNO = '06';
break;
case 'July': $monthNO = '07';
break;
case 'August': $monthNO = '08';
break;
case 'September': $monthNO = '09';
break;
case 'October': $monthNO = '10';
break;
case 'November': $monthNO = '11';
break;
case 'December': $monthNO = '12';
break;
}
require_once('mysql_conn.php');
$sql ="SELECT * FROM salary where month = '$monthNO'";
$result = mysql_query($sql);
$total=0;
while ($row = mysql_fetch_array($result))
{
$sal= $row['p_salary'];
$total = $total + $sal;
}
echo "<html><center>";
echo '<h2>'.'Total Playable Salary: '.$total.' Tk'.'</h2>';
echo "<a href=\"manager.php\">Back to admin page</a>\n";
echo "<a href=\"logout.php\"><h3>Logout</h3></a>\n";
echo "</center></html>";
}
?>