-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaksi.php
73 lines (48 loc) · 1.25 KB
/
aksi.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
<?php
error_reporting(0);
include_once("koneksi.php");
$del = $_GET['del'];
if(!empty($del))
{
mysqli_query($sambung, "DELETE FROM karyawan WHERE id=$del");
header("Location: index.php");
}
if (isset($_POST['edit']))
{
$id = $_POST['id'];
$nama= $_POST['nama'];
$jabatan= $_POST['jabatan'];
$hari= $_POST['hari'];
if ($_POST['jabatan']=='Staff') {
$gaji=120000*$hari;
}
elseif ($_POST['jabatan']=='Pengawas') {
$gaji=250000*$hari;
}
elseif ($_POST['jabatan']=='Cleaning') {
$gaji=65000*$hari;
}
mysqli_query($sambung, "UPDATE karyawan SET nama='$nama',jabatan='$jabatan',gaji='$gaji' WHERE id=$id");
header("Location: index.php");
}
elseif (isset($_POST['tambah']))
{
$nama= $_POST['nama'];
$jabatan= $_POST['jabatan'];
$hari= $_POST['hari'];
if ($_POST['jabatan']=='Staff') {
$gaji=120000*$hari;
}
elseif ($_POST['jabatan']=='Pengawas') {
$gaji=250000*$hari;
}
elseif ($_POST['jabatan']=='Cleaning') {
$gaji=65000*$hari;
}
mysqli_query($sambung, "INSERT INTO karyawan(nama,jabatan,gaji) VALUES('$nama','$jabatan','$gaji')");
header("Location: index.php");
}
else {
header("Location: index.php");
}
?>