prepare("INSERT INTO tasks (title, description) VALUES (?, ?)"); $stmt->execute([$title, $description]); } 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; }