prepare( 'UPDATE activities SET ActivityType = ?, Status = ?, DueDate = ?, Notes = ? WHERE ActivityID = ?' ); $stmt->execute([ $activity_type, $status, $due_date, $notes, $activity_id ]); $_SESSION['success_message'] = 'Activity updated successfully!'; } catch (PDOException $e) { // In a real app, log this error. $_SESSION['error_message'] = 'Failed to update activity. Please try again.'; } header('Location: index.php'); exit();