View sourcecode

The following files exists in this folder. Click to view.

edit_user.php

25 lines UTF-8 Unix (LF)
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
<?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>