forked from mishbahmyname/phpnative
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathubahDataMahasiswa.php
More file actions
69 lines (60 loc) · 1.92 KB
/
Copy pathubahDataMahasiswa.php
File metadata and controls
69 lines (60 loc) · 1.92 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
59
60
61
62
63
64
65
66
67
68
69
<?php
require 'koneksi.php';
$id = $_GET['id'];
$mahasiswa = mysqli_query($koneksi, "SELECT * FROM mahasiswa WHERE id='$id'");
$mhs = mysqli_fetch_assoc($mahasiswa);
if (isset($_POST['ubah'])) {
if (ubahDataMahasiswa($_POST) > 0) {
echo "
<script>
alert('data berhasil diubah!');
document.location.href = 'index.php';
</script>
";
} else {
echo "
<script>
alert('data gagal diubah!');
document.location.href = 'index.php';
</script>
";
}
}
?>
<!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 action="" method="post">
<input type="hidden" name="id" value="<?= $mhs['id']; ?>">
<ul>
<li>
<label for="nrp">NRP : </label>
<input type="text" name="nrp" id="nrp" required value="<?= $mhs['nrp'] ?>">
</li>
<li>
<label for="nama">Nama : </label>
<input type="text" name="nama" id="nama" required value="<?= $mhs['nama'] ?>">
</li>
<li>
<label for="email">Email : </label>
<input type="text" name="email" id="email" required value="<?= $mhs['email'] ?>">
</li>
<li>
<label for="jurusan">jurusan : </label>
<input type="text" name="jurusan" id="jurusan" required value="<?= $mhs['jurusan'] ?>">
</li>
<li>
<label for="gambar">gambar : </label>
<input type="text" name="gambar" id="gambar" value="<?= $mhs['gambar'] ?>">
</li>
<button type="submit" name="ubah">Ubah</button>
</ul>
</form>
</body>
</html>