<?php

require "quizrooDB.php";
if (isset($_GET['delete'])) {
    // delete the option
    require 'member.php';
    require 'quiz.php';
    // also pass in the member id for security check
    $quiz = new Quiz($_GET['id']);
    $member = new Member();
    if (!$quiz->removeOption($_GET['option'], $member->id)) {
        echo "Delete not authorized";
    }
} else {
    // get result number
    $question = $_GET['questionNumber'];
    $option = $_GET['optionNumber'];
    $quiz = $_GET['id'];
    // prepare result options
    $querySQL = "SELECT result_id, result_title FROM q_results WHERE fk_quiz_id = " . GetSQLValueString($quiz, "int");
    $resultID = mysql_query($querySQL, $quizroo) or die(mysql_error());
    $row_resultID = mysql_fetch_assoc($resultID);
    $results = array();
    do {
        $results[] = array($row_resultID['result_id'], $row_resultID['result_title']);
    } while ($row_resultID = mysql_fetch_assoc($resultID));
    mysql_free_result($resultID);
    ?>
<div id="cq<?php 
    echo $question;
    ?>