Show sourcecode
The following files exists in this folder. Click to view.
createquiz.php
createtable.php
dbconnection.php
index.php
login.php
myquiz.php
registrera.php
results.php
results2.php
takequiz.php
myquiz.php
38 lines UTF-8 Windows (CRLF)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<?php
include "dbconnection.php";
$user_id = $_SESSION['user_id'];
$stmt = $dbconn->prepare(
"SELECT id, title FROM quiz WHERE user_id = :user_id"
);
$stmt->execute([':user_id' => $user_id]);
$quizList = $stmt->fetchAll();
?>
<h1>Mina quiz</h1>
<ul>
<?php foreach ($quizList as $quiz) { ?>
<li>
<?= htmlspecialchars($quiz['title']) ?>
<a href="takequiz.php?id=<?= $quiz['id'] ?>">
Gör quiz
</a>
</li>
<?php } ?>
</ul>
<a href="index.php">Tillbaka</a>
</body>
</html>