-
Notifications
You must be signed in to change notification settings - Fork 0
/
edit_data.php
28 lines (24 loc) · 1.2 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
<?php
require_once "api/koneksi.php";
$id = $_REQUEST['id'];
$result = mysqli_query($conn, "SELECT * FROM tb_hewan WHERE id='$id'");
while ($data = mysqli_fetch_assoc($result)) {
?>
<form method="post" id="form-edit">
<input type="hidden" name="id" id="id" readonly value="<?php echo $data['id']; ?>" />
<div class="form-group" style="padding-bottom: 20px;">
<label for="nama">Nama Hewan</label>
<input type="text" name="nama" id="nama" class="form-control" value="<?php echo $data['nama_hewan']; ?>" required />
</div>
<div class="form-group" style="padding-bottom: 20px;">
<label for="jenis">Jenis Hewan</label>
<select class="form-select" id="jenis" name="jenis" required>
<option value="Karnivora" <?php if($data['jenis_hewan']=="Karnivora") {echo "selected"; } ?>>Karnivora</option>
<option value="Herbivora" <?php if($data['jenis_hewan']=="Herbivora") {echo "selected"; } ?>>Herbiovora</option>
<option value="Omnivora" <?php if($data['jenis_hewan']=="Omnivora") {echo "selected"; } ?>>Omnivora</option>
</select>
</div>
</form>
<?php
}
?>