From a7b088c14ae18f9818bf594f5b97e5014d2ef230 Mon Sep 17 00:00:00 2001 From: Albert Goral Date: Mon, 30 Mar 2026 11:29:46 +0200 Subject: [PATCH] =?UTF-8?q?Zapisania=20zam=C3=B3wienia=20(formularza)=20pr?= =?UTF-8?q?zenosi=20do=20listy?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/add_order.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/source/add_order.php b/source/add_order.php index 0bf23d0..a520e87 100644 --- a/source/add_order.php +++ b/source/add_order.php @@ -4,6 +4,9 @@ require_once 'includes/auth.php'; checkAuth(); $message = ''; +if (isset($_GET['saved']) && $_GET['saved'] === '1') { + $message = "
Zamówienie dodane pomyślnie. Możesz dodać kolejne.
"; +} if ($_SERVER["REQUEST_METHOD"] === "POST") { requireCsrfToken(); @@ -17,6 +20,7 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") { $recipient = trim($_POST['recipient'] ?? ''); $delivery_address = trim($_POST['delivery_address'] ?? ''); $company = trim($_POST['company'] ?? ''); + $submit_action = $_POST['submit_action'] ?? 'save_and_list'; if ($product_name !== '' && $quantity > 0) { try { @@ -35,7 +39,12 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") { $hist_stmt->execute([$order_id, $_SESSION['user_id'], 'Utworzono nowe zamówienie.']); $pdo->commit(); - $message = "
Zamówienie dodane pomyślnie.
"; + if ($submit_action === 'save_and_add_new') { + header("Location: add_order.php?saved=1"); + exit(); + } + header("Location: index.php"); + exit(); } catch (PDOException $e) { $pdo->rollBack(); error_log($e->getMessage()); @@ -119,7 +128,10 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") {
Powrót do listy - +
+ + +