The following files exists in this folder. Click to view.
edit_user.php25 lines UTF-8 Unix (LF)
<?php
include("check_login.php");
include("db.php");
$id = $_GET['id'];
$stmt = $pdo->prepare("SELECT * FROM users WHERE id = ?");
$stmt->execute([$id]);
$user = $stmt->fetch(PDO::FETCH_ASSOC);
?>
<h2>Redigera användare</h2>
<form action="update_user.php" method="post">
<input type="hidden" name="id" value="<?= $user['id'] ?>">
Användarnamn:<br>
<input type="text" name="username" value="<?= $user['username'] ?>"><br><br>
Lösenord:<br>
<input type="text" name="password" value="<?= $user['password'] ?>"><br><br>
<input type="submit" value="Uppdatera">
</form>