<?php require_once __DIR__ . "/../config/constants.php"; require_once __DIR__ . "/../controller/ensure_session.php"; require_once __DIR__ . "/../service/data_service.php"; if (!isset($_SESSION["todoId"])) { redirect(VIEWS . "/home.php"); } $taskId = $_SESSION["todoId"]; //Get the information about this record which id is $taskId $task = get_todo($taskId); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="description" content=""> <meta name="author" content=""> <link rel="icon" href="images/favicon.ico"> <title>Never forget another Todo</title> <!-- Bootstrap core CSS --> <link href="<?php echo CSS; ?> /bootstrap.min.css" rel="stylesheet"> <!-- Custom styles for this template -->
$scheduledDate = strtotime($_POST["scheduledDate"]); } //var_dump($scheduledDate); //var_dump($_SESSION); new_todo($description, $scheduledDate, $owner); } else { $_SESSION["error"] = "Task description is required and can have upto 120 characters"; } } redirect(VIEWS . "/home.php"); } else { if ($action == "Edit") { // Edit the content of selected todo; if (isset($_POST["taskId"])) { $todoId = $_POST["taskId"]; $todo = get_todo($todoId); //var_dump($todo); $_SESSION['todo_info'] = $todo; var_dump($todoId); $_SESSION['todo_id'] = $todoId; redirect(VIEWS . "/update_task.php"); } else { $_SESSION["error"] = "Select a task"; redirect(VIEWS . "/home.php"); } // Delete } else { if ($action == "Delete") { if (isset($_POST["taskId"])) { $todoId = $_POST["taskId"]; delete_todo($todoId);