From f823d9354686f2f9a1ae80e7668d3be648e7cb25 Mon Sep 17 00:00:00 2001 From: KubMakCZ Date: Wed, 23 Apr 2025 14:32:51 +0200 Subject: [PATCH] todolist part2 --- 24_todolist_php/delete_task.php | 25 ++++++++++++++++ 24_todolist_php/footer.php | 7 +++-- 24_todolist_php/index.php | 49 +++++++++++++++++++++++++++++++- 24_todolist_php/todolist.sqlite | Bin 12288 -> 12288 bytes 4 files changed, 78 insertions(+), 3 deletions(-) create mode 100644 24_todolist_php/delete_task.php diff --git a/24_todolist_php/delete_task.php b/24_todolist_php/delete_task.php new file mode 100644 index 0000000..7622d57 --- /dev/null +++ b/24_todolist_php/delete_task.php @@ -0,0 +1,25 @@ +prepare("DELETE FROM tasks WHERE id = :id"); + $query->execute(["id" => $task_id]); + header("Location: /?status=deleted"); + exit; + } catch (PDOException $e) { + //echo($e->getMessage()); + header("Location: /?status=db_error"); + exit; + } + } else{ + header("Location: /?status=invalid_id"); + exit; + } +} else { + header("Location: /"); + exit; +} \ No newline at end of file diff --git a/24_todolist_php/footer.php b/24_todolist_php/footer.php index 2d609a1..8b51fcc 100644 --- a/24_todolist_php/footer.php +++ b/24_todolist_php/footer.php @@ -1,9 +1,12 @@ - + \ No newline at end of file diff --git a/24_todolist_php/index.php b/24_todolist_php/index.php index e1cef75..8218464 100644 --- a/24_todolist_php/index.php +++ b/24_todolist_php/index.php @@ -27,12 +27,59 @@ bg-light mb-3"> + + + + + + + + + + + + + + \ No newline at end of file + + + \ No newline at end of file diff --git a/24_todolist_php/todolist.sqlite b/24_todolist_php/todolist.sqlite index a1c83740d2d6b311b3650663164b65ac6b2784fe..6af88d140259776bb401f0e11674a1753adff1b7 100644 GIT binary patch delta 140 zcmZojXh@hK&B!%T#+i|8W5PmyLH-jAto-H-{EzvU@^|rP@tbcJ6j0?4He_RAa5T0l zPACI>4jRhFl03C%R2LJ#7 delta 54 zcmZojXh@hK&B#7c#+i|QW5Pmyeg*~x7XB^<{>S_$_?Pl`Z5C9h;-B0lZ^t6Z#KN%o KjJ&Y`BMShNpbg&u