From 3db61b2973bce137f8c07eea78fbb72105e0bd83 Mon Sep 17 00:00:00 2001 From: fds2610 Date: Thu, 8 Jan 2026 22:03:12 +0100 Subject: [PATCH] Auswahlboxen statt Textfelder bei neuem Eintrag --- html/assets/css/style.css | 4 +- html/new_entry.php | 85 +++++++++++++++++++++++++++++++-------- 2 files changed, 71 insertions(+), 18 deletions(-) diff --git a/html/assets/css/style.css b/html/assets/css/style.css index 3ab46b1..8491663 100644 --- a/html/assets/css/style.css +++ b/html/assets/css/style.css @@ -51,7 +51,7 @@ h1 { margin-bottom: 15px; } -.form-group input { +.form-group input,select { width: 95%; padding: 8px 15px; border: 1px solid #ddd; @@ -60,7 +60,7 @@ h1 { transition: border-color 0.3s ease; } -.form-group input:focus { +.form-group input:focus,select:focus { border-color: var(--primary-color); outline: none; } diff --git a/html/new_entry.php b/html/new_entry.php index f479d5e..7cecd6c 100644 --- a/html/new_entry.php +++ b/html/new_entry.php @@ -4,7 +4,22 @@ if (!isset($_SESSION['user_id'])) { header('Location: index.php'); exit; } +?> + + + + + + FSCash - Neuer Eintrag + + + +execute(); $data_saved = "true"; + } catch (PDOException $e) { // Fehlerbehandlung $data_saved = "Fehler: "; // . $e->getMessage(); @@ -50,21 +66,33 @@ if (!empty($_POST) && isset($DEBUG)) { // $_SERVER['REQUEST_METHOD'] === 'POST' } - // Aktuelles Datum im Format YYYY-MM-DD erzeugen - $currentDate = date('Y-m-d'); +try { + // Alle Benutzer aus der Tabelle 'users' laden + $stmtUsers = $pdo->prepare("SELECT * FROM users;"); + $stmtUsers->execute(); + $users = $stmtUsers->fetchAll(PDO::FETCH_ASSOC); + + foreach ($users as $user) { + if ($user['id'] == $_SESSION['user_id']) { + $loggedInUserId = $user['id']; + break; // Schleife beenden, sobald gefunden + } + } + + // Alle Kategorien aus der Tabelle 'categories' laden + $stmtCategories = $pdo->prepare("SELECT * FROM categories"); + $debug = $stmtCategories->queryString; // Enthält das reine SQL-Statement + $stmtCategories->execute(); + $categories = $stmtCategories->fetchAll(PDO::FETCH_ASSOC); +} catch (PDOException $e) { + $data_saved = "Fehler: "; // . $e->getMessage(); +} + // Aktuelles Datum im Format YYYY-MM-DD erzeugen + $currentDate = date('Y-m-d'); ?> - - - - - - FSCash - Neuer Eintrag - - - - "; ?> + "; ?>
Data @@ -85,19 +113,44 @@ if (!empty($_POST) && isset($DEBUG)) { // $_SERVER['REQUEST_METHOD'] === 'POST' Logout -

Neuer Eintrag

+
- +
+
- + +
+
- + +