4 changed files with 78 additions and 3 deletions
@ -0,0 +1,25 @@ |
|||
<?php |
|||
|
|||
require_once "db_connect.php"; |
|||
|
|||
if ($_SERVER["REQUEST_METHOD"]== "POST") { |
|||
$task_id = $_POST["task_id"] ?? null; //pokud neexistuje tak bude null |
|||
if($task_id && filter_var($task_id,FILTER_VALIDATE_INT)){ |
|||
try { |
|||
$query = $pdo->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; |
|||
} |
@ -1,9 +1,12 @@ |
|||
</div> |
|||
|
|||
<footer class="footer mt-auto py-3 bg-light"> |
|||
<div class="container"> |
|||
<span class="text-muted"> Malá ToDo List aplikace @ 2025</span> |
|||
|
|||
</div> |
|||
</footer> |
|||
|
|||
<script src="js/bootstrap.bundle.js"></script> |
|||
<script src="/js/bootstrap.bundle.js"></script> |
|||
</body> |
|||
</html> |
Binary file not shown.
Loading…
Reference in new issue