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> |
</div> |
||||
|
|
||||
<footer class="footer mt-auto py-3 bg-light"> |
<footer class="footer mt-auto py-3 bg-light"> |
||||
<span class="text-muted"> Malá ToDo List aplikace @ 2025</span> |
|
||||
|
<div class="container"> |
||||
|
<span class="text-muted"> Malá ToDo List aplikace @ 2025</span> |
||||
|
|
||||
|
</div> |
||||
</footer> |
</footer> |
||||
|
|
||||
<script src="js/bootstrap.bundle.js"></script> |
|
||||
|
<script src="/js/bootstrap.bundle.js"></script> |
||||
</body> |
</body> |
||||
</html> |
</html> |
Binary file not shown.
Loading…
Reference in new issue