Template - Php Database Website

<h3>Your Items</h3> <?php if (count($items) > 0): ?> <ul class="items-list"> <?php foreach ($items as $item): ?> <li> <strong><?= htmlspecialchars($item['title']) ?></strong> <p><?= nl2br(htmlspecialchars($item['description'])) ?></p> <small>Created: <?= $item['created_at'] ?></small> </li> <?php endforeach; ?> </ul> <?php else: ?> <p>You haven't added any items yet.</p> <?php endif; ?> <?php include 'includes/footer.php'; ?> <?php session_start(); session_destroy(); header("Location: index.php"); exit(); ?> Step 9: Basic CSS ( assets/css/style.css ) Add this minimal styling to make the template presentable:

if (empty($errors)) { $password_hash = password_hash($password, PASSWORD_DEFAULT);

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>PHP Database Template</title> <link rel="stylesheet" href="assets/css/style.css"> </head> <body> <header> <nav> <div class="logo"> <a href="index.php">MyApp</a> </div> <ul class="nav-links"> <li><a href="index.php">Home</a></li> <?php if (isLoggedIn()): ?> <li><a href="dashboard.php">Dashboard</a></li> <li><a href="logout.php">Logout (<?= htmlspecialchars($_SESSION['username']) ?>)</a></li> <?php else: ?> <li><a href="login.php">Login</a></li> <li><a href="register.php">Register</a></li> <?php endif; ?> </ul> </nav> </header> <main class="container"> php database website template

.nav-links { list-style: none; display: flex; }

label { display: block; margin-bottom: 0.3rem; font-weight: bold; } &lt;h3&gt;Your Items&lt;/h3&gt; &lt;

.container { width: 80%; margin: auto; overflow: auto; padding: 20px; background: white; min-height: 70vh; }

function requireLogin() { if (!isLoggedIn()) { redirect('login.php'); } } ?php if (count($items) &gt

<?php require_once 'config/database.php'; require_once 'includes/functions.php'; requireLogin(); // Handle adding a new item if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['add_item'])) { $title = sanitizeInput($_POST['title']); $description = sanitizeInput($_POST['description']);