m0stwanted143
Eternal Poster
- Joined
- Feb 8, 2016
- Posts
- 925
- Reaction
- 189
- Points
- 310
Code:
<?php
session_start();
include("./config/db_connect.php");
include("templates/sidebar.php"); ?>
<?php include("header.php");
echo"<div>";
$score = 0;
$total == $_SESSION[$score];
$que_no = $_GET['question_no'];
$result=mysqli_query($conn, "SELECT * FROM `exam_questions` where question_no=$que_no");
echo "<form method = "POST">";
echo"<table>";
if($row=mysqli_fetch_array($result)){
echo"<tr>";
echo"<td>".$row['question_no'].")".$row['question']."</td>";
echo"</tr>";
echo"<tr>";
echo"<td>";
echo"<input type='radio' id='option1' name='option' class='radoptions' value=".$row['opt1']." />".$row['opt1']."<br>";
echo"<input type='radio' id='option2' name='option' class='radoptions' value=".$row['opt2']." />".$row['opt2']."<br>";
echo"<input type='radio' id='option3' name='option' class='radoptions' value=".$row['opt3']." />".$row['opt3']."<br>";
echo"<input type='radio' id='option4' name='option' class='radoptions' value=".$row['opt4']." />".$row['opt4']."<br>";
echo"</td>";
echo" </li>";
echo "<br/>";
echo"</tr>";
echo "</tr>";
echo "</table>";
echo "</div>";
if(isset($_POST['option']))
{
$option = $_POST['option'];
}
else{
$option = NULL;
}
if($option != NULL){
if($option != $answer['answer']){
}
else{
echo $score++;
}
}
else{
echo "You must select an answer";
}
}
?>
<?php
$next = mysqli_query($conn, "SELECT * FROM exam_questions WHERE question_no>$que_no order by question_no ASC ");
$sql = "SELECT COUNT(question_no) AS total FROM exam_questions WHERE examname='quizko'";
$result=mysqli_query($conn,$sql);
$values=mysqli_fetch_assoc($result);
$num_rows=$values['total'];
echo "<center><br/><br/><br/>";
echo "Question $que_no of $num_rows";
if($row = mysqli_fetch_array($next)){
echo ' <a href="next.php?question_no='.$row['question_no'].'"><button type="button"> Next</button></a>';
echo "</center>";
}
if($que_no == $num_rows)
{
echo ' <a href="next.php?question_no='.$row['question_no'].'"><button type="button"> submit</button></a>';
}
echo "</form>";
?>
then pag na change ung page yun pa rin yung score nya once na hindi nag sasagot then increment ulit.. I hope na matulungan nyu ko..
Sainyo nalang ako umaasa kasi mga kaklase ko di ako tinutulungan halos thesis namin ako lang gumagawa