prepare("INSERT INTO tasks (title, description, user_id) VALUES (?, ?, ?)"); $stmt->execute([$title, $description, $user_id]); } catch (PDOException $e) { header("Location: index.php?error=" . urlencode("Database error: " . $e->getMessage())); exit; } } header("Location: index.php?success=1"); exit; } else { header("Location: index.php"); exit; }