prepare("SELECT * FROM surveys WHERE id = ?"); $survey_stmt->execute([$survey_id]); $survey = $survey_stmt->fetch(); // If survey doesn't exist, show an error or redirect if (!$survey) { $pageTitle = "Survey Not Found"; require_once 'templates/header.php'; echo "

Survey not found.

"; require_once 'templates/footer.php'; exit; } // Fetch questions for the survey $questions_stmt = db()->prepare("SELECT * FROM survey_questions WHERE survey_id = ? ORDER BY created_at ASC"); $questions_stmt->execute([$survey_id]); $questions = $questions_stmt->fetchAll(); $pageTitle = htmlspecialchars($survey['title']); $description = htmlspecialchars($survey['description']); require_once 'templates/header.php'; ?>

required>