-
Notifications
You must be signed in to change notification settings - Fork 1
/
edit_data.php
81 lines (74 loc) · 2.49 KB
/
edit_data.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
<html>
<head>
<title>Aplikasi CRUD dengan PHP</title>
<link rel="stylesheet" href="css/bootstrap.min.css">
</head>
<body>
<?php
// Load file koneksi.php
include "koneksi.php";
// Ambil data NIS yang dikirim oleh index.php melalui URL
$stambuk = $_GET['stambuk'];
// Query untuk menampilkan data peserta berdasarkan stambuk yang dikirim
$query = "SELECT * FROM peserta WHERE stambuk='".$stambuk."'";
$sql = mysqli_query($connect, $query); // Eksekusi/Jalankan query dari variabel $query
$data = mysqli_fetch_array($sql); // Ambil data dari hasil eksekusi $sql
?>
<div class="container">
<h2>Ubah Data peserta</h2>
<hr>
<form method="post" action="proses_edit.php?stambuk=<?php echo $stambuk; ?>">
<table class="table table-borderless">
<tr>
<td>Stambuk </td>
<td><input type="text" name="stambuk" value="<?php echo $data['stambuk']; ?>" class="form-control" readonly></td>
</tr>
<tr>
<td>Nama </td>
<td><input type="text" name="nama_lengkap" value="<?php echo $data['nama_lengkap']; ?>" class="form-control"></td>
</tr>
<tr>
<td>Alamat </td>
<td><input type="text" name="alamat" value="<?php echo $data['alamat']; ?>" class="form-control"></td>
</tr>
<tr>
<td>Jenis Kelamin</td>
<td>
<?php
if($data['jenis_kelamin'] == "Laki-laki"){
echo "<input type='radio' name='jenis_kelamin' value='laki-laki' checked='checked'> Laki-laki";
echo "<input type='radio' name='jenis_kelamin' value='perempuan'> Perempuan";
}else{
echo "<input type='radio' name='jenis_kelamin' value='laki-laki'> Laki-laki";
echo "<input type='radio' name='jenis_kelamin' value='perempuan' checked='checked'> Perempuan";
}
?>
</td>
</tr>
<tr>
<td>Email</td>
<td><input type="text" name="email" value="<?php echo $data['email']; ?>" class="form-control"></td>
</tr>
<tr>
<td>No HP</td>
<td><input type="text" name="no_hp" value="<?php echo $data['no_hp']; ?>" class="form-control"></td>
</tr>
<tr>
<td>Angkatan</td>
<td><input type="text" name="angkatan" value="<?php echo $data['angkatan']; ?>" class="form-control"></td>
</tr>
<tr>
<td>Kelas</td>
<td><input type="text" name="kelas" value="<?php echo $data['kelas']; ?>" class="form-control"></td>
</tr>
</table>
<hr>
<button type="submit" value="Edit" class="btn btn-primary">
Edit
</button>
<!-- <input type="submit" value="Edit"> -->
<a href="tampil_data_admin.php"><input type="button" value="Batal" class="btn btn-danger"></a>
</form>
</div>
</body>
</html>