prepare("SELECT onboarding_completed FROM users WHERE id = ?"); $stmt->execute([$_SESSION['user_id']]); $user = $stmt->fetch(); if ($user['onboarding_completed']) { header("Location: dashboard.php"); exit; } $error = ''; if ($_SERVER['REQUEST_METHOD'] === 'POST') { $bio = trim($_POST['bio'] ?? ''); $interests = isset($_POST['interests']) ? implode(',', $_POST['interests']) : ''; $investment_appetite = trim($_POST['investment_appetite'] ?? ''); if (empty($bio) || empty($interests) || empty($investment_appetite)) { $error = "Please fill in all required fields."; } else { $stmt = db()->prepare("UPDATE users SET bio = ?, interests = ?, investment_appetite = ?, onboarding_completed = 1 WHERE id = ?"); try { $stmt->execute([$bio, $interests, $investment_appetite, $_SESSION['user_id']]); header("Location: dashboard.php"); exit; } catch (PDOException $e) { $error = "Database error: " . $e->getMessage(); } } } $platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby'; $interests_options = ['Tech', 'Sustainability', 'Healthcare', 'Fintech', 'Education', 'Consumer', 'Social Impact', 'AI', 'SaaS', 'E-commerce']; ?>
Tell us about your investment preferences.