how to do online exam scripting

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Re: how to do online exam scripting

Post by Jonah Bron »

You don't need to put a session into a form item. It persists by itself. Just call it on the result page.
manojsemwal1
Forum Contributor
Posts: 217
Joined: Mon Jun 29, 2009 4:13 am
Location: India

Re: how to do online exam scripting

Post by manojsemwal1 »

when i call the result page last lage value only displayed .
internet-solution
Forum Contributor
Posts: 220
Joined: Thu May 27, 2010 6:27 am
Location: UK

Re: how to do online exam scripting

Post by internet-solution »

In the results page you will have to read the last page's form values + session variables to have all the answers.
manojsemwal1
Forum Contributor
Posts: 217
Joined: Mon Jun 29, 2009 4:13 am
Location: India

Re: how to do online exam scripting

Post by manojsemwal1 »

Sorry to disturb u can u explain how to set session in radio button values. give some suiatable example.

thanks
internet-solution
Forum Contributor
Posts: 220
Joined: Thu May 27, 2010 6:27 am
Location: UK

Re: how to do online exam scripting

Post by internet-solution »

Please see the following codes:

In first page, the questions are listed - answers are in radio buttons -

Code: Select all

<input type="radio" name="q[$i]" value="1" />
You post this page to second page and store values in $_SESSION variable -

Code: Select all

$_SESSION['q'][$i]=$_POST['q'][$i];

//Then you list more question and answers
<input type="radio" name="q[$j]" value="1" />
Post second page to third page and so on

On the last page (results page)

Code: Select all

//you get the posted values from previous page
answers['q'][$i]=$_POST['q'][$i];

//and then get values from $_SESSION
answers['q'][$j]=$_SESSION['q'][$j];
I have just shown the main principles above. Obviously you will have to add for loops in the above codes to recurse through your questions numbers.
Post Reply