Empfangene POST-Daten:"; echo ""; // POST-Daten abrufen und escapen $date = isset($_POST['date']) ? trim($_POST['date']) : ''; $user_id = isset($_POST['user_id']) ? trim($_POST['user_id']) : ''; $person = isset($_POST['person']) ? trim($_POST['person']) : ''; $category = isset($_POST['category']) ? trim($_POST['category']) : ''; $subject = isset($_POST['subject']) ? trim($_POST['subject']) : ''; $amount = isset($_POST['amount']) ? (float)$_POST['amount'] : 0.0; $payment_method = isset($_POST['payment_method']) ? trim($_POST['payment_method']) : ''; // SQL-Statement vorbereiten try { $stmt = $pdo->prepare(" INSERT INTO entries (date, user_id, person, category, subject, amount, payment_method) VALUES (:date, :user_id, :person, :category, :subject, :amount, :payment_method) "); $stmt->bindParam(':date', $date); $stmt->bindParam(':user_id', $user_id); $stmt->bindParam(':person', $person); $stmt->bindParam(':category', $category); $stmt->bindParam(':subject', $subject); $stmt->bindParam(':amount', $amount); $stmt->bindParam(':payment_method', $payment_method); // Statement ausführen $stmt->execute(); $data_saved = "true"; } catch (PDOException $e) { // Fehlerbehandlung $data_saved = "Fehler: "; // . $e->getMessage(); } } // Aktuelles Datum im Format YYYY-MM-DD erzeugen $currentDate = date('Y-m-d'); ?> FSCash - Neuer Eintrag "; ?>
Data

Neuer Eintrag