prepare("INSERT INTO surveys (title, description) VALUES (?, ?)"); $stmt->execute([$title, $description]); header("Location: surveys.php"); // Redirect to avoid form resubmission exit; } } // Pagination $page = isset($_GET['page']) ? (int)$_GET['page'] : 1; $records_per_page = 10; $offset = ($page - 1) * $records_per_page; // Get total number of surveys $total_stmt = db()->query("SELECT COUNT(*) FROM surveys"); $total_records = $total_stmt->fetchColumn(); $total_pages = ceil($total_records / $records_per_page); // Fetch surveys for the current page $surveys_stmt = db()->prepare("SELECT * FROM surveys ORDER BY created_at DESC LIMIT :limit OFFSET :offset"); $surveys_stmt->bindValue(':limit', $records_per_page, PDO::PARAM_INT); $surveys_stmt->bindValue(':offset', $offset, PDO::PARAM_INT); $surveys_stmt->execute(); $surveys = $surveys_stmt->fetchAll(); $pageTitle = "Manage Surveys"; require_once 'templates/header.php'; ?>

Manage Surveys

Back to Submissions

Create New Survey

Existing Surveys

No surveys created yet.