From f826204f2edbf82d842b6f24f1c4b83e70ec7d46 Mon Sep 17 00:00:00 2001 From: Emil Miler Date: Sun, 15 Nov 2020 10:49:21 +0100 Subject: [PATCH] =?UTF-8?q?Zp=C4=9Btn=C3=A1=20vazba=20po=20odesl=C3=A1n?= =?UTF-8?q?=C3=AD=20formul=C3=A1=C5=99e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Po odeslání formuláře je uživatel přesměrován zpět s parametrem `odeslano`. JavaScript ve stránce odchytává parametry a pokud narazí na tento daný parametr, ohlásí uživateli, že formulář byl odeslán. --- static/php/insert.php | 2 +- templates/index.html | 2 ++ templates/page.html | 11 +++++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/static/php/insert.php b/static/php/insert.php index 48c8126..09e5db2 100644 --- a/static/php/insert.php +++ b/static/php/insert.php @@ -79,5 +79,5 @@ $db = new database("./db/database.db"); $query = createquery($_REQUEST["form"]); $db->query("$query[0]",$query[1]); -$refer = (!empty($_SERVER["HTTP_REFERER"]) ? $_SERVER["HTTP_REFERER"] : "/"); +$refer = (!empty($_SERVER["HTTP_REFERER"]) ? $_SERVER["HTTP_REFERER"]."?odeslano" : "/"); header("Location: ".$refer); diff --git a/templates/index.html b/templates/index.html index 970e9aa..24196d0 100644 --- a/templates/index.html +++ b/templates/index.html @@ -31,5 +31,7 @@ , {{ now() | date(format="%Y") }}

+ {% block javascript %} + {% endblock javascript %} diff --git a/templates/page.html b/templates/page.html index 313d058..629f0e5 100644 --- a/templates/page.html +++ b/templates/page.html @@ -3,3 +3,14 @@ {% block content %} {{ page.content | safe }} {% endblock content %} + +{% block javascript %} + +{% endblock javascript %}