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 a1c8374..6af88d1 100644 Binary files a/24_todolist_php/todolist.sqlite and b/24_todolist_php/todolist.sqlite differ