-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcreate_process.php
96 lines (90 loc) · 2.16 KB
/
create_process.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
<?php
$conn=mysqli_connect('localhost','pjuser','12345678','awscop');
$basic=$_POST['basic'];
$extra=$_POST['extra'];
if ($basic <=2000000){
$tax=0.01;
}
elseif ($basic<=4000000) {
$tax=0.02;
}
else {
$tax=0.03;
}
$salary=($basic+$extra)*(1-$tax);
$filtered=array(
'name' => mysqli_real_escape_string($conn, $_POST['name']),
'rank' => mysqli_real_escape_string($conn, $_POST['rank']),
'basic' => mysqli_real_escape_string($conn, $basic),
'extra' => mysqli_real_escape_string($conn, $extra)
);
$sql="
INSERT INTO employee_salary (name, position, base_pay, extra_pay, tax_rate, salary)
VALUES (
'{$filtered['name']}',
'{$filtered['rank']}',
'{$filtered['basic']}',
'{$filtered['extra']}',
$tax,
$salary
)"
;
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>AWSCOP</title>
<link rel="shortcut icon" type="image/x-icon" href="images/favicon.png">
<link rel="stylesheet" href="css/style.css" type="text/css">
</head>
<body>
<div id="page">
<div id="header">
<div id="logo">
<a href="index.php"><img src="images/logo.png" alt="LOGO"></a>
</div><!--logo-->
<ul id="navigation">
<li><a href="create.php">Registration</a></li>
<li><a href="print.php">View/Modify</a></li>
</ul><!--navigation-->
</div><!--header-->
<div id="contents">
<?php
$result=mysqli_query($conn, $sql);
if($result === false) {
echo 'A post registration error has occurred. Please contact your administrator.';
echo error_log(mysqli_error($conn));
} else {
header('Location: index.php');
}
?>
</div><!--contents-->
<div id="footer">
<div id="links">
<li>
<h4>When Something Wrong</h4>
<ul>
<li>TEL : 0212345678</li>
<li>E-MAIL : [email protected]</li>
</ul>
</li>
<li>
<h4>Social Links</h4>
<ul id="connect">
<li>
<a href="https://twitter.com/" target="_blank">Twitter</a>
</li>
<li>
<a href="https://www.facebook.com/" target="_blank">Facebook</a>
</li>
</ul><!--connect-->
</li>
</div><!--links-->
<p class="footnote">
© 2020. Hong Su Min all rights reserved.
</p>
</div><!--footer-->
</div><!--page-->
</body>
</html>