Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

passing data through 10 pages 2

Status
Not open for further replies.

zuu2343

IS-IT--Management
Sep 18, 2002
12
US
Hi, I am creating a quiz with php including 10 questions. For each question I'd like to have a different page.

As the user answer each question, their point will increase or remain same.

I used simple form with post method, and I can have first two pages working.

However, my problem is I can not keep their scores for other pages with post method.

Is there any way I can keep their scores and show them at the end without using sessions? And how am i going to do it?

If you know a website about this topic, that'll be great too.

Thanks for the help...
 
I forgot to tell you , I do not have any database installed on the server. Quiz will be take and quit kind of one..
 
What I would do is use a carry-over input of type "hidden" on each page.

As the user walks through the pages of the quiz, the script can use the value from the hidden field to add to or subtract from the score.

Want the best answers? Ask the best questions: TANSTAAFL!
 
Thanks for the quick answer.. I really appreciate it.

with the hidden type, can I show their points on the quiz pages like below?how?

quiz page2
wrong answer point 1

quiz page3
right answer point2

quiz page4
wrong answer point2

thnaks again..
 
here is the code i have so far, but fourth page still shows the score from the second
*****************************************************

<!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;>
<html>
<head>
<title>Quiz</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
</head>

<body>
<table width=&quot;75%&quot; border=&quot;0&quot;>
<tr>
<td><form name=&quot;form1&quot; method=&quot;post&quot; action=&quot;question2.php&quot;>
<table width=&quot;100%&quot; border=&quot;1&quot;>
<tr>
<td height=&quot;112&quot;>
<p>Your point</p>
<p><img src=&quot;0.gif&quot; width=&quot;70&quot; height=&quot;70&quot;></p>
</td>
</tr>
</table>
<table width=&quot;100%&quot; border=&quot;1&quot;>
<tr>
<td colspan=&quot;2&quot;><p>Question: 1</p>
<p>What is your favorite color?</p></td>
</tr>
<tr>
<td>A.
<input type=&quot;radio&quot; name=&quot;q1&quot; value=&quot;1&quot;> </td>
<td width=&quot;93%&quot;>Red</td>
</tr>
<tr>
<td>B.
<input type=&quot;radio&quot; name=&quot;q1&quot; value=&quot;2&quot;></td>
<td>Blue</td>
</tr>
<tr>
<td>C.
<input type=&quot;radio&quot; name=&quot;q1&quot; value=&quot;3&quot;></td>
<td>Green</td>
</tr>
<tr>
<td>D.
<input type=&quot;radio&quot; name=&quot;q1&quot; value=&quot;4&quot;></td>
<td>Yellow</td>
</tr>
<tr>
<td height=&quot;28&quot;></td>
<td><input type=&quot;hidden&quot; name=&quot;Submit&quot; value=&quot;Submit&quot;></td>
</tr>
</table>
</form></td>
</tr>
</table>
</body>
</html>
******************************************************
<!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;>
<html>
<head>
<title>Quiz</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
</head>
<body>
<table width=&quot;75%&quot; border=&quot;0&quot;>
<tr>
<td><form name=&quot;form1&quot; method=&quot;post&quot; action=&quot;question3.php&quot;>
<table width=&quot;100%&quot; border=&quot;1&quot;>
<tr>
<td height=&quot;112&quot;> <p>Your point</p>
<?php
$point = 0;
if ($q1 == 1)
{
$point ++;
}
print(&quot;<img src='$point'.gif/></p></td>&quot;)
?>
</tr>
</table>
<table width=&quot;100%&quot; border=&quot;1&quot;>
<tr>
<td colspan=&quot;2&quot;><p>Question: 1</p>
<p>What is your favorite color?</p></td>
</tr>
<tr>
<td>A.
<input type=&quot;radio&quot; name=&quot;q2&quot; value=&quot;1&quot;> </td>
<td width=&quot;93%&quot;>Red</td>
</tr>
<tr>
<td>B.
<input type=&quot;radio&quot; name=&quot;q2&quot; value=&quot;2&quot;></td>
<td>Blue</td>
</tr>
<tr>
<td>C.
<input type=&quot;radio&quot; name=&quot;q2&quot; value=&quot;3&quot;></td>
<td>Green</td>
</tr>
<tr>
<td>D.
<input type=&quot;radio&quot; name=&quot;q2&quot; value=&quot;4&quot;></td>
<td>Yellow</td>
</tr>
<tr>
<td height=&quot;28&quot;></td>
<td><input type=&quot;hidden&quot; name=&quot;Submit&quot; value=&quot;Submit&quot;></td>
</tr>
</table>
</form></td>
</tr>
</table>
</body>
</html>
*******************************************************
<!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;>
<html>
<head>
<title>Quiz</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
</head>
<body>
<table width=&quot;75%&quot; border=&quot;0&quot;>
<tr>
<td><form name=&quot;form1&quot; method=&quot;post&quot; action=&quot;question4.php&quot;>
<table width=&quot;100%&quot; border=&quot;1&quot;>
<tr>
<td height=&quot;112&quot;> <p>Your point</p>
<?php
$pointafter = $point;
if ($q2 == 1)
{
$pointafter ++;
}
print(&quot;<img src='$pointafter'.gif/></p></td>&quot;)
?>
</tr>
</table>
<table width=&quot;100%&quot; border=&quot;1&quot;>
<tr>
<td colspan=&quot;2&quot;><p>Question: 1</p>
<p>What is your favorite color?</p></td>
</tr>
<tr>
<td>A.
<input type=&quot;radio&quot; name=&quot;q3&quot; value=&quot;1&quot;> </td>
<td width=&quot;93%&quot;>Red</td>
</tr>
<tr>
<td>B.
<input type=&quot;radio&quot; name=&quot;q3&quot; value=&quot;2&quot;></td>
<td>Blue</td>
</tr>
<tr>
<td>C.
<input type=&quot;radio&quot; name=&quot;q3&quot; value=&quot;3&quot;></td>
<td>Green</td>
</tr>
<tr>
<td>D.
<input type=&quot;radio&quot; name=&quot;q3&quot; value=&quot;4&quot;></td>
<td>Yellow</td>
</tr>
<tr>
<td height=&quot;28&quot;></td>
<td><input type=&quot;submit&quot; name=&quot;Submit&quot; value=&quot;Submit&quot;></td>
</tr>
</table>
</form></td>
</tr>
</table>
</body>
</html>
***************************************************
 
On page 3, you would have the following:

Code:
<input type=&quot;hidden&quot; name=&quot;pageonescore&quot; value=&quot;$pageonescore&quot;>
<input type=&quot;hidden&quot; name=&quot;pagetwoscore&quot; value=&quot;$pagetwoscore&quot;>

and pass $pagethreescore as the value of the answer.



OR - - Why reinvent the wheel? How about another direction entirely?...


I used this a few years ago (I assume it is still good). It is a quick HTML quiz maker.
 
Thank you so much sleipnir214, and jimoblak

You helped me a lot..

I'll go with the hidden. it works now.

good luck on your work..



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top