-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
edit_kelas.php
105 lines (98 loc) · 4.16 KB
/
edit_kelas.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
<?php
// memanggil file koneksi.php untuk membuat koneksi
include 'koneksi.php';
// mengecek apakah di url ada nilai GET id
if (isset($_GET['id'])) {
// ambil nilai id dari url dan disimpan dalam variabel $id
$id = ($_GET["id"]);
// menampilkan data dari database yang mempunyai id=$id
$query = "SELECT * FROM kelas WHERE id_kelas='$id'";
$result = mysqli_query($koneksi, $query);
// jika data gagal diambil maka akan tampil error berikut
if(!$result){
die ("Query Error: ".mysqli_errno($koneksi).
" - ".mysqli_error($koneksi));
}
// mengambil data dari database
$data = mysqli_fetch_assoc($result);
// apabila data tidak ada pada database maka akan dijalankan perintah ini
if (!count($data)) {
echo "<script>alert('Data tidak ditemukan pada database');window.location='kelas.php';</script>";
}
} else {
// apabila tidak ada data GET id pada akan di redirect ke index.php
echo "<script>alert('Masukkan data id.');window.location='kelas.php';</script>";
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Edit KELAS</title>
</head>
<body>
<?php
include ('tampilan/header.php');
include ('tampilan/sidebar.php');
include ('tampilan/footer.php');
?>
<div class="main-content bg-primary">
<section class="section">
<div class="section-header">
<h1>EDIT KELAS</h1>
<div class="section-header-breadcrumb">
<div class="breadcrumb-item active"><a href="#">Dashboard</a></div>
<div class="breadcrumb-item"><a href="kelas.php">Data Kelas</a></div>
<div class="breadcrumb-item text-primary">Edit Kelas</div>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="card">
</div>
<div class="card-body bg-primary">
<div class="row mt-4">
<div class="col-12 col-lg-8 offset-lg-2">
<div class="wizard-steps">
<div class="wizard-step wizard-step-active">
<div class="wizard-step-icon">
<i class="fas fa-school"></i>
</div>
<div class="wizard-step-label">
Formulir Kelas
</div>
</div>
</div>
</div>
</div>
<form class="wizard-content mt-2" method="post" action="proses_editkelas.php">
<div class="wizard-pane">
<input name="id" value="<?php echo $data['id_kelas']; ?>" hidden />
<div class="form-group row align-items-center">
<label class="col-md-4 text-md-right text-white">NAMA KELAS</label>
<div class="col-lg-4 col-md-6">
<input type="text" name="nama_kelas" value="<?php echo $data['nama_kelas']; ?>" required=""/>
</div>
</div>
<div class="form-group row align-items-center">
<label class="col-md-4 text-md-right text-white">KOMPETENSI KEAHLIAN</label>
<div class="col-lg-4 col-md-6">
<input type="text" name="kompetensi_keahlian" value="<?php echo $data['kompetensi_keahlian']; ?>" required=""/>
</div>
</div>
<div class="form-group row">
<div class="col-md-4"></div>
<div class="col-lg-4 col-md-6 text-right">
<button type="submit" class="btn btn-icon icon-right btn-primary">UBAH KELAS<i class="fas fa-arrow-right"></i></button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</section>
</div>
</div>
</div>