Page 1 of 2
how to do online exam scripting
Posted: Fri Apr 23, 2010 12:28 am
by manojsemwal1
Somebody help me to develope online exam scripting .
give some link tutorial aur demo script.
thanks
Re: how to do online exam scripting
Posted: Fri Apr 23, 2010 7:03 am
by maneetpuri
Hi,
If you can tell more about what you need in it then someone might give you some directions.
Or the other (rather better) way is outsource it to some web services firm.
Cheers,
Re: how to do online exam scripting
Posted: Mon Apr 26, 2010 6:52 am
by manojsemwal1
1- i want when user take the test the times should be start and the given time the process should be stop.
2- how to evaluate the Result.
3 each and every time when user login randomly question will be select.
Thanks
Re: how to do online exam scripting
Posted: Mon Apr 26, 2010 12:32 pm
by Jonah Bron
This should give you some tutorials to start with:
http://lmgtfy.com/?q=php+make+quiz+tutorial
Re: how to do online exam scripting
Posted: Sat May 29, 2010 2:05 am
by manojsemwal1
thanks for your link .
I had trdied but not get suitable link...
tell me how to evalute the marks when user click on submit button question and answer comes from databases.
thanks
Re: how to do online exam scripting
Posted: Sat May 29, 2010 3:18 am
by internet-solution
I am assuming test will consist of multiple choice question (e.g. check boxes, radio buttons or drop down lists). You can simply put them in a form and then post the form to a PHP file. This PHP file will contain code for marking the answers. You will need to store correct answer(s) and mark for each question in the database. Then check user answers with correct answers and add mark to total mark only if they match.
Edit --
You can see an example -
one of my early projects
Re: how to do online exam scripting
Posted: Sat May 29, 2010 6:26 am
by manojsemwal1
Thanks for your reply.............
presently iam using only radio button. and the questions are fetched from database.my code are as follows
Code: Select all
<?php
include 'db.php';
?>
<form name="frm" action="result.php" method="post">
<?php
$page_name="questions.php"; // If you use this code with a different page ( or file ) name then change this
$start=$_GET['start'];
//echo $start;
//echo $search;
//echo $Affiname;
if(strlen($start) > 0 and !is_numeric($start)){
echo "Data Error";
exit;
}
$eu = ($start - 0);
$limit = 2; // No of records to be shown per page.
$this1 = $eu + $limit;
$back = $eu - $limit;
$next = $eu + $limit;
$query2=" select * from questionpaper";
$result2=mysql_query($query2);
echo mysql_error();
$nume=mysql_num_rows($result2);
$sql="select * from questionpaper limit $eu, $limit";
//echo $sql;
$rss=mysql_query($sql) or die (mysql_error());
$count = mysql_num_rows($rss);
echo '<b>'."Total No of Students -:". $nume.'</b>';
//echo $count;
$i=1;
$n=0;
if($count==0)
{
echo"<tr><td colspan=14 bgcolor =#f1ece1><center><strong>Data Not found</td></tr>";
}
else
{
while ($b=mysql_fetch_array($rss))
{
echo "<br>".$i ."".$b[Question]."<br>";
echo"<input type='radio' name='q' value='1'>"."". $b[Ans1]."<br>";
echo"<input type='radio' name='q' value=2''>"."". $b[Ans2]."<br>";
echo"<input type='radio' name='q' value='3'>"."". $b[Ans3]."<br>";
echo"<input type='radio' name='q' value=4''>"."". $b[Ans4]."<br>";
$i++;
}
}
?>
<input type="submit" value="Finish">
but when i select next question answer then the first question answer is deselect...give some solution. and tell me how to check answer in database.
thanks
Re: how to do online exam scripting
Posted: Sat May 29, 2010 12:47 pm
by internet-solution
Yiu are using the same name for all radio buttons (name=q) and they are becoming part of the same radio button group and you can only select one of them. You need to give different name to different questions. Use something like
Code: Select all
while ($b=mysql_fetch_array($rss))
{
echo "<br>".$i ."".$b[Question]."<br>";
echo"<input type='radio' name='q{$i}' value='1'>"."". $b[Ans1]."<br>";
echo"<input type='radio' name='q{$i}' value=2''>"."". $b[Ans2]."<br>";
echo"<input type='radio' name='q{$i}' value='3'>"."". $b[Ans3]."<br>";
echo"<input type='radio' name='q{$i}' value=4''>"."". $b[Ans4]."<br>";
$i++;
}
Re: how to do online exam scripting
Posted: Sat May 29, 2010 1:06 pm
by phdatabase
The last post suggests adding the value of $i to the name based on the use of {$i}. This is a valid solution, however, if you create an array, you will get the same effect with the bonus of easier back end coding.
echo"<input type='radio' name='q[$i]' value='1'>"."". $b[Ans1]."<br>";
Re: how to do online exam scripting
Posted: Sun May 30, 2010 11:21 pm
by manojsemwal1
Thanks for your valuable reply ya its ok fine. pl help little bit more to try understand.
like ...iam using paging to take exam and set 2 question in each page so when user go back in previous quesions. question are unselected how to select question when user back and how to count the user answers.
thanks ..............
Re: how to do online exam scripting
Posted: Mon May 31, 2010 2:56 pm
by internet-solution
After a page is posted and the form input values are not retained when user comes back. You will have to fill them in your script. The easiest way will be to store the values is SESSION variables and when the page is loaded check if these variables are set. If yes then populate form input elements from SESSION variables, else keep them blank.
You can also store these values on MySQL database.
Re: how to do online exam scripting
Posted: Tue Jun 01, 2010 12:25 am
by manojsemwal1
Ya its ok fine .but when user finished the paper and click on submit button then how to post answer in result page while we are using many check box like user select 40 question the the radio box id will 4o. so how to get data from radio boxes.
Thanks.
Re: how to do online exam scripting
Posted: Tue Jun 01, 2010 6:32 am
by internet-solution
As explained in previous posts, you can name the checkbox / radio buttons as arrays, then store them in SESSION variables (again as arrays) between pages and then on the final page when the Submit button is pressed, then do a foreach on the SESSION variables and get the answers. Then you can check against correct answeres and add up the marks for each question.
Re: how to do online exam scripting
Posted: Fri Jun 04, 2010 7:45 am
by manojsemwal1
Dear
I had tried to put session in radio button but not succedd like
<input type="radio" name="q[$i]" value="1"<?php if($_SESSION['rad_radio']) echo 'checked="checked"'; ?> />
Pl Help how to get value from previous question in result page
thanks
Manoj
Re: how to do online exam scripting
Posted: Mon Jun 07, 2010 6:26 am
by manojsemwal1
Pl Send some suatiable answer to make this.