62 lines
2.4 KiB
PHP
62 lines
2.4 KiB
PHP
<?php
|
|
require_once __DIR__ . '/db/config.php';
|
|
|
|
// Fetch all public surveys
|
|
$pdo = db();
|
|
$surveys_stmt = $pdo->query("SELECT id, title, description, created_at FROM surveys ORDER BY created_at DESC");
|
|
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
<title>FormFlex Pro - Available Surveys</title>
|
|
<meta name="description" content="FormFlexPro: Streamline survey creation and data analysis with seamless respondent integration.">
|
|
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
<link rel="stylesheet" href="assets/css/custom.css">
|
|
</head>
|
|
<body>
|
|
|
|
<div class="container mt-5 mb-5">
|
|
<div class="text-center mb-5">
|
|
<h1 class="display-4">FormFlex Pro</h1>
|
|
<p class="lead">The future of survey creation and data analysis.</p>
|
|
<hr class="my-4">
|
|
<p>Below is a list of our publicly available surveys. Please choose one to begin.</p>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<?php if ($surveys_stmt->rowCount() > 0): ?>
|
|
<?php while ($survey = $surveys_stmt->fetch()): ?>
|
|
<div class="col-md-6 col-lg-4 mb-4">
|
|
<div class="card h-100">
|
|
<div class="card-body d-flex flex-column">
|
|
<h5 class="card-title"><?php echo htmlspecialchars($survey['title']); ?></h5>
|
|
<p class="card-text flex-grow-1"><?php echo htmlspecialchars($survey['description']); ?></p>
|
|
<a href="survey.php?id=<?php echo $survey['id']; ?>" class="btn btn-primary mt-auto">Take Survey</a>
|
|
</div>
|
|
<div class="card-footer text-muted">
|
|
Posted on <?php echo htmlspecialchars(date('F j, Y', strtotime($survey['created_at']))); ?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php endwhile; ?>
|
|
<?php else: ?>
|
|
<div class="col-12">
|
|
<div class="alert alert-info text-center">No surveys are available at this time.</div>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
|
|
<footer class="text-center mt-5">
|
|
<p class="text-muted">Powered by FormFlex Pro</p>
|
|
</footer>
|
|
</div>
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
|
|
</body>
|
|
</html>
|