-
Notifications
You must be signed in to change notification settings - Fork 0
/
ubah.php
63 lines (48 loc) · 1.64 KB
/
ubah.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
<?php
require_once 'function.php';
$id = $_GET['id'];
$mhs = query("SELECT * FROM mahasiswa WHERE id='$id'")[0];
if (isset($_POST['ubah'])) {
if (ubah($_POST) > 0) {
echo "<script>
alert('Data Berhasil diubah');
document.location.href='index.php';
</script>";
exit;
} else {
echo "<script>
alert('Data gagal diubah');
document.location.href='index.php';
</script>";
exit;
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Ubah Data Mahasiswa</title>
</head>
<body>
<h1>UBAH DATA MAHASISWA</h1>
<form method="post" action="" enctype="multipart/form-data">
<input type="hidden" name="id" value="<?= $mhs['id']; ?>">
<input type="hidden" name="gambarLama" value="<?= $mhs['gambar']; ?>">
<label for="npm">Npm : </label>
<input type="number" name="npm" id="npm" value="<?= $mhs['npm']; ?>"><br>
<label for="nama">Nama : </label>
<input type="text" name="nama" id="nama" value="<?= $mhs['nama']; ?>"><br>
<label for="jurusan">Jurusan : </label>
<input type="text" name="jurusan" id="jurusan" value="<?= $mhs['jurusan']; ?>"><br>
<label for="email">Email : </label>
<input type="email" name="email" id="email" value="<?= $mhs['email']; ?>"><br>
<label for="gambar">Gambar</label>
<img src="img/<?= $mhs['gambar']; ?>" alt="gambar" style="width:80px; height:80px;">
<br>
<input type="file" name="gambar" id="gambar"><br><br>
<button type="submit" name="ubah">Ubah Data Mahasiswa</button>
</form>
</body>
</html>