55 lines
1.3 KiB
PHP
55 lines
1.3 KiB
PHP
<!DOCTYPE html>
|
|
<html lang="de">
|
|
|
|
<head>
|
|
<link href="index.css" rel="stylesheet" />
|
|
|
|
<meta charset="utf-8" />
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
|
|
<title>PHP Course</title>
|
|
</head>
|
|
|
|
<body>
|
|
<?php
|
|
include_once "../base/errors.php";
|
|
include_once "../base/headers.php";
|
|
Headers::html();
|
|
include_once "../base/database.php";
|
|
|
|
$db = DB::openConnection();
|
|
|
|
$query = "SELECT * FROM users ORDER BY ID";
|
|
|
|
$stmt = $db->prepare($query);
|
|
$stmt->execute();
|
|
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
|
|
DB::closeConnection($db);
|
|
?>
|
|
<div class="col">
|
|
<div class="list">
|
|
<?php
|
|
foreach ($result as $item) {
|
|
?>
|
|
<div class="item">
|
|
<span class="marker"><?= $item["ID"] ?></span>
|
|
<span class="content"><?= $item["Name"] ?></span>
|
|
<form action="action.php" method="post">
|
|
<input type="hidden" name="ID" value="<?= $item["ID"] ?>" />
|
|
<button name="act" value="rem">Entfernen</button>
|
|
</form>
|
|
</div>
|
|
<?php
|
|
}
|
|
?>
|
|
</div>
|
|
<form action="action.php" method="post" class="add">
|
|
<label>Name:</label>
|
|
<input name="name" placeholder="Name" required />
|
|
<button name="act" value="add">Hinzufügen</button>
|
|
</form>
|
|
</div>
|
|
</body>
|
|
|
|
</html>
|