-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuat-loker.php
127 lines (106 loc) · 4.08 KB
/
buat-loker.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
<?php
// panggil koneksi db
require "db.php";
// panggil file functions.php
require "functions.php";
// aktifkan session
session_start();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- judul -->
<title>Buat Lowongan Kerja</title>
<!-- headtags -->
<?php require "headtags.php"; ?>
</head>
<body>
<!-- navbar -->
<?php require "navbar.php"; ?>
<!-- body -->
<div class="container mt-5">
<div class="card col-md-8 offset-md-2">
<div class="card-header text-center">
<h3>Buat Loker Baru</h3>
</div>
<div class="card-body">
<form action="" method="POST">
<div class="form-group">
<input type="text" class="form-control" placeholder="Posisi" name="posisi">
</div>
<div class="form-group">
<select class="form-control" id="exampleFormControlSelect1" name="lulusan">
<option value="Tanpa Ijasah" selected>Tanpa Ijasah</option>
<option value="SD">SD</option>
<option value="SMP">SMP</option>
<option value="SMA">SMA/K</option>
<option value="D1">D1</option>
<option value="D2">D2</option>
<option value="D3">D3</option>
<option value="D4">D4</option>
<option value="S1">S1</option>
<option value="S2">S2</option>
<option value="S3">S3</option>
</select>
</div>
<div class="form-group">
<textarea class="form-control" name="jobdesk" id="" placeholder="Jobdesk" name="jobdesk"></textarea>
</div>
<div class="form-group">
<textarea class="form-control" name="keterangan" id="" placeholder="Keterangan" name="keterangan"></textarea>
</div>
<div class="form-group text-center">
<button class="btn btn-primary" name="postingLoker">Posting Loker</button>
</div>
</form>
</div>
</div>
</div>
<!-- footer -->
<?php require 'footer.php'; ?>
</body>
</html>
<?php
// jika bukan perusahaan, maka tendang ke index
if (!isset($_SESSION["perusahaan"])) {
echo "
<script>
Swal.fire('AKSES DITOLAK','Anda Tidak Login Sebagai Perusahaan','warning').then(function(){
window.location = 'index.php';
});
</script>
";
}
// jika tombol posting loker sudah di tekan
if (isset($_POST["postingLoker"])){
// tangkap semua nilai
$posisi = htmlspecialchars($_POST["posisi"]);
$lulusan = htmlspecialchars($_POST["lulusan"]);
$jobdesk = htmlspecialchars($_POST["jobdesk"]);
$keterangan = htmlspecialchars($_POST["keterangan"]);
// cari idPerusahaan
$emailPerusahaan = $_SESSION["perusahaan"];
$perusahaan = mysqli_query($db, "SELECT * FROM perusahaan WHERE email = '$emailPerusahaan'");
$perusahaan = mysqli_fetch_assoc($perusahaan);
$idPerusahaan = $perusahaan["id"];
// validasi kolom
if (cekKosong($posisi) == true){
if (cekKosong($lulusan) == true){
if (cekKosong($jobdesk) == true){
if (cekKosong($keterangan) == true){
mysqli_query($db, "INSERT INTO loker VALUES ('',$idPerusahaan,'$posisi','$lulusan','$jobdesk','$keterangan','Aktif')");
echo "
<script>
Swal.fire('LOKER BERHASIL DIPOSTING','','success').then(function(){
window.location = 'data-loker.php';
});
</script>
";
}
}
}
}
}
?>