'danger', 'message' => 'Error: Could not upload the file.']; } } // If file upload was successful (or no file was uploaded), update the database if ($notification === null) { try { $pdo = db(); $stmt = $pdo->prepare( "UPDATE tasks SET status = 'in review', completion_notes = ?, proof_file_path = ? WHERE id = ?" ); $stmt->execute([$completion_notes, $proof_file_path, $submitted_task_id]); $_SESSION['notification'] = ['type' => 'success', 'message' => 'Task submitted successfully for review!']; header("Location: tasks.php"); exit; } catch (PDOException $e) { // For development: error_log($e->getMessage()); $notification = ['type' => 'danger', 'message' => 'Error: Could not update the task.']; } } } // Fetch task details for display $task = null; if ($task_id > 0) { try { $pdo = db(); $stmt = $pdo->prepare("SELECT * FROM tasks WHERE id = ?"); $stmt->execute([$task_id]); $task = $stmt->fetch(PDO::FETCH_ASSOC); } catch (PDOException $e) { die("Error: Could not connect to the database or fetch task."); } } // If task not found, redirect if (!$task) { header("Location: tasks.php"); exit; } // Check for notifications from previous page (e.g., after redirect) if (isset($_SESSION['notification'])) { $notification = $_SESSION['notification']; unset($_SESSION['notification']); } $pageTitle = htmlspecialchars($task['title']); $page = 'tasks'; ?> <?php echo $pageTitle; ?> - Task App

Back to Tasks

Reward: BDT Status:
Submit for Review