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 |
<?php include("koneksi.php"); ?> <html> <head> <title>Ubah</title> <link rel="stylesheet" type="text/css" href="gaya.css"> </head> <body> <?php include('menu.php'); echo '<p>Mengubah suatu record</p>'; $username = isset($_POST['username']) ? $_POST['username'] : ''; $password = isset($_POST['password']) ? $_POST['password'] : ''; $nama = isset($_POST['nama']) ? $_POST['nama'] : ''; $lahir = isset($_POST['lahir']) ? $_POST['lahir'] : ''; $nilai = isset($_POST['nilai']) ? $_POST['nilai'] : ''; $stmt = $pdo->prepare('UPDATE tugas1 SET password = ?, nama = ?, lahir = ?, nilai = ? WHERE username = ?'); if ($stmt->execute([md5($password), $nama, $lahir, $nilai, $username])) { echo '<p>Perubahan telah direkam.</p>'; } else { echo '<p>Gagal merekam data.</p>'; }; ?> </body> </html> |