Eingaben gehen bei Fehlermeldungen nicht verloren
This commit is contained in:
@@ -46,8 +46,12 @@ session_start();
|
|||||||
<?php
|
<?php
|
||||||
unset($_SESSION["message"]);
|
unset($_SESSION["message"]);
|
||||||
?>
|
?>
|
||||||
<input type="text" id="title" name="title" placeholder="Titel hier eingeben" required>
|
<input type="text" id="title" name="title"
|
||||||
<textarea id="content" name="content" placeholder="Schreibe deinen Beitrag..."></textarea>
|
value="<?php if (isset($_SESSION['old_title'])){htmlspecialchars($_SESSION['old_title'] ?? '');} unset($_SESSION['old_title']); ?>"
|
||||||
|
placeholder="Titel hier eingeben" required>
|
||||||
|
<textarea id="content" name="content" placeholder="Schreibe deinen Beitrag...">
|
||||||
|
<?php if (isset($_SESSION['old_content'])){htmlspecialchars($_SESSION['old_content'] ?? '');} unset($_SESSION['old_content']); ?>
|
||||||
|
</textarea>
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
<!-- Seitenleiste -->
|
<!-- Seitenleiste -->
|
||||||
@@ -104,7 +108,9 @@ session_start();
|
|||||||
|
|
||||||
<div class="sidebar-block">
|
<div class="sidebar-block">
|
||||||
<label for="tags">Schlagwörter</label>
|
<label for="tags">Schlagwörter</label>
|
||||||
<input type="text" id="tags" name="tags" placeholder="z.B. Technik, IT (mit Komma trennen)">
|
<input type="text" id="tags" name="tags"
|
||||||
|
value="<?php if(isset($_SESSION['old_tags'])){htmlspecialchars($_SESSION['old_tags'] ?? '');} unset($_SESSION['old_tags']); ?>"
|
||||||
|
placeholder="z.B. Technik, IT (mit Komma trennen)">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</aside>
|
</aside>
|
||||||
|
|||||||
@@ -4,6 +4,10 @@ require_once '../model/LocalArticleManager.php';
|
|||||||
require_once '../model/ArticleManager.php';
|
require_once '../model/ArticleManager.php';
|
||||||
|
|
||||||
if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
||||||
|
$_SESSION["old_title"] = $_POST["title"] ?? '';
|
||||||
|
$_SESSION["old_content"] = $_POST["content"] ?? '';
|
||||||
|
$_SESSION["old_category"] = $_POST["category"] ?? '';
|
||||||
|
$_SESSION["old_tags"] = $_POST["tags"] ?? '';
|
||||||
if(!isset($_POST["title"]) ||!isset($_POST["content"]) || !isset($_POST["category"])){
|
if(!isset($_POST["title"]) ||!isset($_POST["content"]) || !isset($_POST["category"])){
|
||||||
$_SESSION["message"] = "missing_parameters";
|
$_SESSION["message"] = "missing_parameters";
|
||||||
header("location: ../../index.php?pfad=createArticle");
|
header("location: ../../index.php?pfad=createArticle");
|
||||||
|
|||||||
Reference in New Issue
Block a user