May 29, 2020

Mawan.my.id

Blog Mawan di DobelHost

ubah3.php

<?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>

 

Leave a Reply

Your email address will not be published. Required fields are marked *