<!DOCTYPE html>
<html>
<head>
	<title>Edit User Log</title>
<link rel="stylesheet" type="text/css" href="css/userprofile.css">
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/simple-keyboard.css">
<script src="js/jquery-2.2.3.min.js"></script>
</head>
<body>

<?php 
	require_once('header.php');
	require_once("connectDB.php");

	if (isset($_GET['id'])) {
		$id=$_GET['id'];
		$sql = "SELECT * FROM data_logs WHERE id='$id'";
		$query = mysqli_query($conn, $sql);
		$row = mysqli_fetch_assoc($query);
	}

	if (isset($_GET['action']) && $_GET['action'] == 'save') {
		$id = $_POST['id'];
		$note = $_POST['note'];
	
		$qryUpdate = "UPDATE data_logs SET note='$note' WHERE id='$id'";
		$queryInput = mysqli_query($conn, $qryUpdate);
	
		if($qryUpdate) {	
		  header('Location: UsersLog.php');
		}
	}	
?>
<br>
<main class="container">
	<h1 class="slideInDown animated" style="margin-bottom: 25px !important;">Edit User Logs</h1>
	<div class="form-style-5 slideInDown animated">
		<form action="?action=save" method="POST" enctype="multipart/form-data">
			<fieldset>
				<input type="text" name="id" id="id" value="<?=$row['id'];?>" readonly>
				<input type="text" name="tgl" id="tgl" value="<?=$row['tgl'];?>" readonly>
				<input class="input" type="text" name="note" id="note" placeholder="Keterangan" value="<?=$row['note'];?>" required>
			</fieldset>
			<div class="simple-keyboard"></div>
			<br>
			<button type="submit" name="user_pro_upd" class="user_pro_upd">Save</button>
			
			<script src="js/simple-keyboard.js"></script>
			<script src="js/my-simple-keyboard.js"></script>
		</form>
	</div>	
</main>
</body>
</html>