|
Posted by Rik on 07/31/07 21:45
On Tue, 31 Jul 2007 23:39:36 +0200, nice.guy.nige =
<nigel_moss@deadspam.com> wrote:
> While the city slept, php.ajay@gmail.com (php.ajay@gmail.com) feverish=
ly
> typed...
>
>> Hi
>> I have a great problem. I have successfully completed
>> ONLINE EXAM project.But Finally client asked "I want to include time
>> for my site."O.K I tried But every time when i click on next question=
>> time is also refreshed and it comes from starting time.Please help
>> me.VERY URGENT
>> Thank u
>
> Assuming as other posters have said that this is a form with a questio=
n, =
> and
> then onto the next page... maybe something like;
>
> q1.php
> =3D=3D=3D=3D=3D
>
> <form name=3D"quiz1" action=3D"q2.php" method=3D"post">
> <input type=3D"hidden" value=3D"<? echo time(); ?>" name=3D"startTime"=
>
> What colour is blue? <input type=3D"text" name=3D"q1">
> <input type=3D"submit">
> </form>
>
> q2.php
> =3D=3D=3D=3D=3D
>
> <?
> if($_POST["q1"] =3D=3D "blue") {
> $score =3D 1;
> }
> else {
> $score =3D 0;
> }
> ?>
>
> <form name=3D"quiz2" action=3D"q3.php" method=3D"post">
> <input type=3D"hidden" value=3D"<? echo $_POST["startTime"]; ?>"
> name=3D"startTime">
> <input type=3D"hidden" value=3D"<? echo $score; ?>" name=3D"score">
> How many eggs in a dozen? <input type=3D"text" name=3D"q2">
> <input type=3D"submit">
> </form>
>
> ... etc...
>
> end.php
> =3D=3D=3D=3D=3D=3D
>
> <?
> $startTime =3D $_POST["startTime"];
> $endTime =3D time();
> $totalTime =3D $endTime - $startTime;
> $score =3D $_POST["score"];
> ?>
>
> <p>Your score was <? echo $score; ?> and you took <? echo $totalTime; =
?> =
> to
> complete the quiz</p>
>
> ... This is all off the top of my head and not tested in anyway shape =
or
> form, but it may at least give you some ideas to work on.
Then again, I can easily manipulate hidden post values to my liking, =
without to much trouble even (there are browser extentions that do this)=
..
Want the data safe? Store in on the server, easiest would be in a sessio=
n, =
and use that.
-- =
Rik Wasmus
Navigation:
[Reply to this message]
|