From 87ffa36c1bfa49259e48d94f09e64f83632f0071 Mon Sep 17 00:00:00 2001 From: Maksymilian Jopek Date: Thu, 13 Apr 2023 15:47:15 +0200 Subject: v1.0.0 --- cardEdit.php | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 cardEdit.php (limited to 'cardEdit.php') diff --git a/cardEdit.php b/cardEdit.php new file mode 100644 index 0000000..9fce311 --- /dev/null +++ b/cardEdit.php @@ -0,0 +1,84 @@ +setAttribute(PDO::ATTR_EMULATE_PREPARES, false); + + if ($id === -1) + $sql = "INSERT INTO `cms_card`(`title`, `body`) VALUES (:title, :body)"; + else + $sql = "UPDATE `cms_card` SET `title`= :title, `body`=:body WHERE `id`=:id"; + + $stmt = $pdo->prepare($sql); + + if ($id === -1) { + $stmt->execute([ + "title" => $_POST["title"], + "body" => nl2br($_POST["body"]), + ]); + } else { + $stmt->execute([ + "title" => $_POST["title"], + "body" => nl2br($_POST["body"]), + "id" => $_POST["id"], + ]); + } + + $_POST["edited_card"] = null; + header("Location: cardsList.php"); + exit(); +} +?> + + + + + + + + + + + + Edit card + + + +
+ +
+

Card

+
+
+ +
+ " required>
+
+
+ Dodaj"; + else + echo ""; + ?> +


+

+
+
+ + + + + \ No newline at end of file -- cgit v1.3.1