-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtambah_ayah_siswa.php
312 lines (284 loc) · 14.9 KB
/
tambah_ayah_siswa.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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
<!DOCTYPE html>
<html>
<?php
// include "configuration/config_etc.php";
include "configuration/config_include.php";
// etc();
encryption();
session();
connect();
head();
body();
timing();
//alltotal();
pagination();
$get_id_siswa = $_GET['id'];
?>
<?php
if (!login_check()) {
?>
<meta http-equiv="refresh" content="0; url=logout" />
<?php
exit(0);
}
?>
<div class="wrapper">
<?php
theader();
menu();
?>
<div class="content-wrapper">
<section class="content-header">
</section>
<!-- Main content -->
<section class="content">
<div class="row">
<div class="col-lg-12">
<!-- ./col -->
<!-- SETTING START-->
<?php
error_reporting(E_ALL ^ (E_NOTICE | E_WARNING));
include "configuration/config_chmod.php";
$tabeldatabase = "siswa"; // tabel database
$forward = mysqli_real_escape_string($conn, $tabeldatabase); // tabel database
$sql = "SELECT * FROM siswa ORDER BY id_siswa DESC LIMIT 1";
$data = mysqli_query($conn, $sql);
$fetch = mysqli_fetch_array($data);
?>
<!-- SETTING STOP -->
<!-- BREADCRUMB -->
<!-- <ol class="breadcrumb ">
<li><a href="<?php echo $_SESSION['baseurl']; ?>">Dashboard </a></li>
<li><a href="<?php echo $halaman; ?>"><?php echo $dataapa ?></a></li>
<?php
if ($search != null || $search != "") {
?>
<li> <a href="<?php echo $halaman; ?>">Data <?php echo $dataapa ?></a></li>
<li class="active"><?php
echo $search;
?></li>
<?php
} else {
?>
<li class="active">Data <?php echo $dataapa ?></li>
<?php
}
?>
</ol> -->
<!-- BREADCRUMB -->
<!-- BOX INSERT BERHASIL -->
<script>
window.setTimeout(function() {
$("#myAlert").fadeTo(500, 0).slideUp(1000, function() {
$(this).remove();
});
}, 5000);
</script>
<!-- BOX INFORMASI -->
<?php
if ($_SESSION['jabatan'] == 'admin' || $_SESSION['jabatan'] == 'guru') {
?>
<!-- KONTEN BODY AWAL -->
<div class="box box-default">
<div class="box-header with-border">
<h3 class="box-title">Tambah Data Ayah Siswa <?= $fetch['nama_siswa'] ?></h3>
</div>
<!-- /.box-header -->
<div class="box-body">
<div class="table-responsive">
<!----------------KONTEN------------------->
<div id="main">
<div class="container-fluid">
<form class="form-horizontal" method="post" action="" id="Myform">
<div class="nav-tabs-custom">
<ul class="nav nav-tabs">
<li class="active"><a href="#tab_1" data-toggle="tab">Data Ayah</a></li>
</ul>
</div>
<div class="tab-content">
<div class="tab-pane active" id="tab_1">
<div class="col-lg-6">
<div class="row">
<div class="form-group col-md-12 col-xs-12">
<label for="namaayah" class="col-sm-3 control-label">Nama Ayah:</label>
<div class="col-sm-9">
<input type="text" class="form-control" id="nama_ayah" name="nama_ayah" value="<?php echo $nama_ayah; ?>">
</div>
</div>
</div>
<div class="row">
<div class="form-group col-md-12 col-xs-12">
<label for="tempatayah" class="col-sm-3 control-label">Tahun Lahir:</label>
<div class="col-sm-6">
<input type="text" class="form-control" id="tahun_lahir_ayah" name="tahun_lahir_ayah" value="<?php echo $tahun_lahir_ayah; ?>">
</div>
</div>
</div>
<div class="row">
<div class="form-group col-md-12 col-xs-12">
<label for="pendidikanterakhirayah" class="col-sm-3 control-label">Pendidikan Terakhir:</label>
<div class="col-sm-9">
<select class="form-control " style="width: 100%;" name="pendidikanterakhirayah" id="pendidikanterakhirayah">
<option value=''></option>
<option value='Tidak sekolah'>Tidak sekolah</option>
<option value='Putus SD'>Putus SD</option>
<option value='SD / sederajat'>SD / sederajat</option>
<option value='SMP / sederajat'>SMP / sederajat</option>
<option value='SMA / sederajat'>SMA / sederajat</option>
<option value='S1'>S1</option>
<option value='S2'>S2</option>
<option value='S3'>S3</option>
<option value='D1'>D1</option>
<option value='D2'>D2</option>
<option value='D3'>D3</option>
<option value='D4'>D4</option>
</select>
</div>
</div>
</div>
<div class="row">
<div class="form-group col-md-12 col-xs-12">
<label for="pekerjaanayah" class="col-sm-3 control-label">Pekerjaan:</label>
<div class="col-sm-9">
<select class="form-control " style="width: 100%;" name="pekerjaanayah" id="pekerjaanayah">
<option value=''></option>
<option value='Tidak bekerja'>Tidak bekerja</option>
<option value='Tidak dapat diterapkan'>Tidak dapat diterapkan</option>
<option value='Sudah Meninggal'>Sudah Meninggal</option>
<option value='Wiraswasta'>Wiraswasta</option>
<option value='Wirausaha'>Wirausaha</option>
<option value='Karyawan Swasta'>Karyawan Swasta</option>
<option value='Pedagang Kecil'>Pedagang Kecil</option>
<option value='Petani'>Petani</option>
<option value='Buruh'>Buruh</option>
<option value='PNS/TNI/Polri'>PNS/TNI/Polri</option>
<option value='Lainnya'>Lainnya</option>
</select>
</div>
</div>
</div>
<div class="row">
<div class="form-group col-md-12 col-xs-12">
<label for="penghasilanayah" class="col-sm-3 control-label">Penghasilan Perbulan:</label>
<div class="col-sm-9">
<!-- <input type="text" class="form-control" id="penghasilanayah" name="penghasilanayah" value="<?php echo $pekerjaanayah; ?>"> -->
<select class="form-control " style="width: 100%;" name="penghasilanayah" id="penghasilanayah">
<option value=''></option>
<option value='Tidak Berpenghasilan'>Tidak Berpenghasilan</option>
<option value='Kurang dari Rp. 500,000'>Kurang dari Rp. 500,000</option>
<option value='Rp. 500,000 - Rp. 999,999'>Rp. 500,000 - Rp. 999,999</option>
<option value='Rp. 1,000,000 - Rp. 1,999,999'>Rp. 1,000,000 - Rp. 1,999,999</option>
<option value='Rp. 2,000,000 - Rp. 4,999,999'>Rp. 2,000,000 - Rp. 4,999,999</option>
<option value='Rp. 5,000,000 - Rp. 20,000,000'>Rp. 5,000,000 - Rp. 20,000,000</option>
<option value='Lebih dari Rp. 20,000,000'>Lebih dari Rp. 20,000,000</option>
</select>
</div>
</div>
</div>
<div class="row">
<div class="form-group col-md-12 col-xs-12">
<label for="nik_ayah" class="col-sm-3 control-label">NIK Ayah:</label>
<div class="col-sm-9">
<input type="text" class="form-control" id="nik_ayah" name="nik_ayah" value="<?php echo $nik_ayah; ?>">
</div>
</div>
</div>
<div class="box-footer">
<button type="submit" class="btn btn-default pull-left btn-flat" name="simpan"><span class="glyphicon glyphicon-floppy-disk"></span> Simpan</button>
<a href="tambah_ibu_siswa">
<button type="button" class="ml-3 btn btn-info pull-left btn-flat" name="simpan"> Tidak ada data ayah <span class="glyphicon glyphicon-arrow-right"></span></button>
</a>
</div>
</div>
</div>
</div>
</form>
<?php
if (isset($_POST['simpan'])) {
$id_siswa = $fetch['id_siswa'];
$nama_ayah = $_POST["nama_ayah"];
$pekerjaanayah = $_POST["pekerjaanayah"];
$penghasilanayah = $_POST["penghasilanayah"];
$pendidikanterakhirayah = $_POST["pendidikanterakhirayah"];
$tahun_lahir_ayah = $_POST["tahun_lahir_ayah"];
$nik_ayah = $_POST["nik_ayah"];
if (empty($nama_ayah)) {
echo "<script>alert('Nama Ayah Siswa Tidak Boleh Kosong')</script>";
} else {
$sql = "INSERT INTO ayah_siswa (id_siswa, nama_ayah,pekerjaan_ayah,penghasilan_ayah, jenjang_pendidikan_ayah, tahun_lahir_ayah, nik_ayah) VALUES ('$id_siswa','$nama_ayah','$pekerjaanayah','$penghasilanayah','$pendidikanterakhirayah','$tahun_lahir_ayah','$nik_ayah')";
$run_sql = mysqli_query($conn, $sql);
if ($run_sql) {
echo "<script>alert('Berhasil tambah data');location.href='tambah_ibu_siswa'</script>";
} else {
echo "<script>
alert('gagal')
</script>";
}
}
}
?>
</div>
</div>
</div>
<!-- /.box-body -->
</div>
</div>
<?php
} else {
?>
<div class="callout callout-danger">
<h4>Info</h4>
<b>Hanya user tertentu yang dapat mengakses halaman <?php echo $dataapa; ?> ini .</b>
</div>
<?php
}
?>
<!-- ./col -->
</div>
<!-- /.row -->
<!-- Main row -->
<div class="row">
<!-- Left col -->
<!-- /.Left col -->
</div>
<!-- /.row (main row) -->
</section>
<!-- /.content -->
</div>
<!-- /.content-wrapper -->
<?php footer(); ?>
<div class="control-sidebar-bg"></div>
</div>
<!-- ./wrapper -->
<script src="dist/plugins/jQuery/jquery-2.2.3.min.js"></script>
<script src="https://code.jquery.com/ui/1.11.4/jquery-ui.min.js"></script>
<script>
$.widget.bridge('uibutton', $.ui.button);
</script>
<script src="dist/bootstrap/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/raphael/2.1.0/raphael-min.js"></script>
<script src="dist/plugins/morris/morris.min.js"></script>
<script src="dist/plugins/sparkline/jquery.sparkline.min.js"></script>
<script src="dist/plugins/jvectormap/jquery-jvectormap-1.2.2.min.js"></script>
<script src="dist/plugins/jvectormap/jquery-jvectormap-world-mill-en.js"></script>
<script src="dist/plugins/knob/jquery.knob.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.11.2/moment.min.js"></script>
<script src="dist/plugins/daterangepicker/daterangepicker.js"></script>
<script src="dist/plugins/datepicker/bootstrap-datepicker.js"></script>
<script src="dist/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.min.js"></script>
<script src="dist/plugins/slimScroll/jquery.slimscroll.min.js"></script>
<script src="dist/plugins/fastclick/fastclick.js"></script>
<script src="dist/js/app.min.js"></script>
<script src="dist/js/demo.js"></script>
<script src="dist/plugins/datatables/jquery.dataTables.min.js"></script>
<script src="dist/plugins/datatables/dataTables.bootstrap.min.js"></script>
<script src="dist/plugins/slimScroll/jquery.slimscroll.min.js"></script>
<script src="dist/plugins/fastclick/fastclick.js"></script>
<script src="dist/plugins/select2/select2.full.min.js"></script>
<script src="dist/plugins/input-mask/jquery.inputmask.js"></script>
<script src="dist/plugins/input-mask/jquery.inputmask.date.extensions.js"></script>
<script src="dist/plugins/input-mask/jquery.inputmask.extensions.js"></script>
<script src="dist/plugins/timepicker/bootstrap-timepicker.min.js"></script>
<script src="dist/plugins/iCheck/icheck.min.js"></script>
</body>
</html>