prepare("SELECT * FROM surveys WHERE id = ?"); $survey_stmt->execute([$survey_id]); $survey = $survey_stmt->fetch(); if (!$survey) { header('Location: surveys.php'); exit; } // Handle form submission for updating survey if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['title'])) { $title = trim($_POST['title']); $description = trim($_POST['description']); if (!empty($title)) { $stmt = db()->prepare("UPDATE surveys SET title = ?, description = ? WHERE id = ?"); $stmt->execute([$title, $description, $survey_id]); header("Location: surveys.php"); // Redirect to the survey list exit; } } $pageTitle = "Edit Survey"; require_once 'templates/header.php'; ?>

Edit Survey

Back to Surveys