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 - +
+ + +