-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathubah.php
More file actions
58 lines (56 loc) · 1.95 KB
/
ubah.php
File metadata and controls
58 lines (56 loc) · 1.95 KB
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
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Rizky Eventa Bahtiar</title>
</head>
<body>
<?php
$koneksi = mysqli_connect("localhost","root","","php-api");
$id = $_GET['id'];
$qry = mysqli_query($koneksi,"SELECT * FROM users WHERE id='$id'");
$data = mysqli_fetch_array($qry);
function radio($value, $input) {
$result = $value==$input?'checked':'';
return $result;
}
?>
<form action="edit.php" method="post">
<table align="center">
<tr>
<td colspan="2" style="background-color: #2196F3; color: #fff">
<h3><center><?php echo $data['id']; ?></center></h3>
</td>
</tr>
<tr>
<td>Username</td>
<td>
<input type="text" name="username" value="<?php echo $data['username']; ?>">
<input type="hidden" name="id" value="<?php echo $data['id']; ?>">
</td>
</tr>
<tr>
<td>Password</td>
<td><input type="password" name="password" value="<?php echo $data['password']; ?>"></td>
</tr>
<tr>
<td style="vertical-align: top">Level</td>
<td>
<input type="radio" name="level" value="admin" <?php echo radio("admin", $data['level']) ?>>Admin<br>
<input type="radio" name="level" value="user" <?php echo radio("user", $data['level']) ?>>User<br>
<input type="radio" name="level" value="guest" <?php echo radio("guest", $data['level']) ?>>guest
</td>
</tr>
<tr>
<td>Fullname</td>
<td><input type="text" name="fullname" value="<?php echo $data['fullname']; ?>"></td>
</tr>
<tr>
<td colspan="2">
<center><button type="submit" value="Simpan">SIMPAN</button></center>
</td>
</tr>
</table>
</form>
</body>
</html>