<?php
$count;
session_start();
print_r($_SESSION);
$myarray=array();
$myarray=@$_SESSION['myarray'];
$myarray=array();
$myarray=@$_SESSION['myarray'];
$host="localhost"; // Host name
$username="root"; // Mysql username
$password=""; // Mysql password
$db_name="candidates"; // Database name
$tbl_name="qbank"; // Table name
// Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
if($_POST['next']=="next")
{
if(@$_SESSION['count']<=10)
{
echo @$_SESSION['count'];
$myarray=array();
$myarray=@$_SESSION['myarray'];
echo " --------- ";
$myid=$myarray[@$_SESSION['count']-1];
$query=mysql_query("SELECT * FROM qbank WHERE qbank.qid=$myid");
if($query)
{
while($row = mysql_fetch_assoc($query))
{
echo("<pre>");
echo"</br>";
echo $row['qtext']; echo"</br>";
$value1=$row['choiceA'];
print "<input type='radio' name='choiceA' value='$value1'>".$value1."</input><br />";
$value2=$row['choiceB'];
print "<input type='radio' name='choiceA' value='$value2'>".$value2."</input><br />";
$value3=$row['choiceC'];
print "<input type='radio' name='choiceC' value='$value3'>".$value3."</input><br />";
$value4=$row['choiceD'];
print "<input type='radio' name='choiceD' value='$value4'>".$value4."</input><br />";
echo("<pre>");
}
}
}
else
{
echo "Reach final";
}
$count=@$_SESSION['count'];
$count++;
$_SESSION['count']=$count;
}
if($_POST['next']=="skip")
{
}
?>
<form name="form1" method="post" action="questionpaper.php">
<input name="next" type="submit" value="next" />
<input name="next" type="submit" value="skip" />
</form>
Prathibha K G 0 Newbie Poster
JorgeM 958 Problem Solver Team Colleague Featured Poster
Jamblaster 15 Newbie Poster
mchourishi 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.