-
Notifications
You must be signed in to change notification settings - Fork 0
/
update_mahasiswa.php
44 lines (40 loc) · 1.67 KB
/
update_mahasiswa.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
<?php
$host = 'localhost';
$username = 'root'; // username untuk database
$password = ''; // password untuk database
$database = 'primakara'; // nama database yang ingin digunakan
$connect = mysqli_connect($host, $username, $password, $database); // cara mengkoneksikan database
$nimTerpilih = $_GET['nim'];
$kodeSelectDataTerpilih =
"SELECT * FROM mahasiswa WHERE nim = '$nimTerpilih'";
$tampilDataTerpilih =
mysqli_query($connect, $kodeSelectDataTerpilih);
$dataTerpilih = mysqli_fetch_array($tampilDataTerpilih);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Update Data</title>
</head>
<body>
<table border="1">
<form action="proses_update_mahasiswa.php?nim=<?php echo $dataTerpilih['nim']; ?>" method="POST">
<tr>
<td>NIM</td>
<td>Nama</td>
<td>Jurusan</td>
<td>Aksi</td>
</tr>
<tr>
<td><input type="text" name="nim" value="<?php echo $dataTerpilih['nim']; ?>"></td>
<td><input type="text" name="nama" value="<?php echo $dataTerpilih['nama']; ?>"></td>
<td><input type="text" name="jurusan" value="<?php echo $dataTerpilih['jurusan']; ?>"></td>
<td><input type="submit" value="Submit"></td>
</tr>
</form>
</table>
</body>
</html>