Show sourcecode
The following files exists in this folder. Click to view.
account.php
create_quiz.js
create_quiz.php
fetch_table.php
frontpage.php
header.php
login.php
quiz.php
quiz_answer_finished.php
quiz_creation_finished.php
signup.php
style.css
create_quiz.php
94 lines UTF-8 Windows (CRLF)
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
<?php
session_start();
if ($_SESSION["isLoggedIn"] != true) {
// Program to display complete URL
$link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']
=== 'on' ? "https" : "http") . "://" .
$_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
// Display the complete URL
$_SESSION['lastVisited'] = $link;
header("Location:login.php?redirect=true");
}
include('../../incl/dbconnection.php');
/**
* @var PDO $dbconn
*/
?>
<!DOCTYPE html>
<html lang="sv">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Quiz Cross - skapa quiz</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<?php
include('header.php');
?>
<h1 class="text-center">Skapa quiz</h1>
<div class="center-container">
<form action="quiz_creation_finished.php" method="post">
<!-- Vi skickar all data som görs i quizzet via POST, men quiz_id hämtas via GET genom att
bara helt enkelt modifiera URL:en. Som i login.php
Detta för att låta användaren dela quizzes till andra -->
<div id="quiz-container">
<!-- <hr class="force-hr"> -->
<div class="row">
<label for="quizName">
<h3>Namn på quiz:</h3>
</label>
<input type="text" class="quiz-input" name="quizName" id="quizName" placeholder="Mitt roliga quiz" required>
</div>
<hr class="force-hr">
<div class="create-question" id="q1">
<div class="row">
<label for="question1">Fråga 1:</label>
<div class="question-create">
<input type="text" class="quiz-input" name="question1" id="question1" placeholder="Min roliga fråga" required>
</div>
</div>
<ul class="option-container">
<li class="option">
<div class="row">
<label for="question1choice1">Alternativ 1:</label>
<div class="choice-container">
<input type="text" name="question1choice1" id="question1choice1" placeholder="Mitt alternativ" required>
<input type="checkbox" name="question1choice1Correct" id="question1choice1Correct">
<label for="question1choice1Correct">Rätt?</label>
<button type="button" class="cross-button remove-choice"><img src="../../Media/ikoner/close_black.svg" alt=""></button>
</div>
</div>
</li>
<li class="option">
<div class="row">
<label for="question1choice2">Alternativ 2:</label>
<div class="choice-container">
<input type="text" name="question1choice2" id="question1choice2" placeholder="Mitt alternativ" required>
<input type="checkbox" name="question1choice2Correct" id="question1choice2Correct">
<label for="question1choice2Correct">Rätt?</label>
<button type="button" class="cross-button remove-choice"><img src="../../Media/ikoner/close_black.svg" alt=""></button>
</div>
</div>
</li>
</ul>
<button class="addChoiceButton indent" type="button">Lägg till alternativ...</button>
</div>
</div>
<!-- <hr class="force-hr" style="margin: 2rem 0;"> -->
<div class="row">
<button id="addQuestionButton" type="button" onclick="addQuestion()" style="height: 2rem;">Lägg till fråga...</button>
</div>
<hr class="force-hr">
<input type="submit" value="Skapa quiz" style="height: 3rem;">
</form>
</div>
<script src="create_quiz.js"></script>
</body>
</html>