// save the data from step 1
     $quiz_picture = $_POST['result_picture_0'] != "" ? $_POST['result_picture_0'] : "none.gif";
     if (isset($_POST['id'])) {
         $quiz = new Quiz($_POST['id']);
         // Modified on 20 Oct by Hien for getting type and display_mode from the database
         // for test_simple to skip the result step
         $query = sprintf("SELECT fk_quiz_type, display_mode FROM q_quizzes WHERE quiz_id = %d", GetSQLValueString($_POST['id'], "int"));
         $getQuery = mysql_query($query, $quizroo) or die(mysql_error());
         $row_getQuery = mysql_fetch_assoc($getQuery);
         $mode = $row_getQuery['display_mode'];
         $type = $row_getQuery['fk_quiz_type'];
         $quiz_id = $quiz->update($_POST['quiz_title'], $_POST['quiz_description'], $_POST['quiz_cat'], $quiz_picture, $member->id, $mode, $type);
     } else {
         $quiz = new Quiz();
         //function createQuiz($title, $description, $cat, $picture, $member_id, $key, $display_mode, $fk_quiz_type) from quiz.php
         $quiz_id = $quiz->createQuiz($_POST['quiz_title'], $_POST['quiz_description'], $_POST['quiz_cat'], $quiz_picture, $member->id, $key, $mode, $type);
     }
     // direct them to step 3 if the quiz is of test type and simple display mode, else direct to step 2
     if ($type == "1" && $mode == "test_simple") {
         header("Location: ../webroot/createQuiz.php?step=3&id=" . $quiz_id);
     } else {
         header("Location: ../webroot/createQuiz.php?step=2&id=" . $quiz_id);
     }
     break;
 case 2:
     // save the quiz results
     // get the id from the form
     $quiz_id = $_POST['id'];
     //***********************************************ADD BY LIEN************************************************//
     $queryMode = sprintf("SELECT display_mode FROM q_quizzes WHERE quiz_id = %d", $quiz_id);
     $resultMode = mysql_query($queryMode, $quizroo) or die(mysql_error());
                        echo $quiz_picture;
                        ?>
</td>
  </tr>
   <tr>
    <td><span class="style15">Display mode:</span></td>
    <td><?php 
                        echo $display_mode;
                        ?>
</td>
  </tr>
  <?php 
                        //create quiz
                        $quiz = new Quiz();
                        //get the quiz_id here to use for inserting questions
                        $quiz_id = $quiz->createQuiz($title, $des, $cat, $quiz_picture, $memberid, 'Admin', $display_mode, 2);
                    }
                    //check if the question is null. If not, insert into database.
                    if ($question != null) {
                        ?>
  <tr bgcolor="#FFCCFF">
    <td><span class="style5">Question:</span></td>
    <td><?php 
                        echo $question;
                        ?>
</td>
  </tr>
  <?php 
                        $question_id = $quiz->addQuestion($question, $memberid);
                    }
                    //check if the option is null. If not, insert into database with reference