I have a PHP text in my page. It has 60 test questions and, at the end, a submit button to find out if the test answers were correct. Problem: is it possible to seperate the 60 questions into 3 different pages (to avoid having to scoll), and to have the submit button at the bottom of the third page, so that the 60 questions are checked. Is there a procedure for doing this? Thanks.i got the same problem
i am working on it, gimme a week or two
but if somebody already has it it will save me some work sure
POST the answers from the first 20 questions to the next page, and put the values into hidden form inputs for the, which are then submitted with the next submit.um...I'm kinda new to php. Do you mean I can make the "hidden" changes in my index.html page, without changing the code in the .php page? Below is the end of the code in the index page. So, um...could you explain the steps a little more? Thanks.
...the combinations and mutations of the clock genes. Some gene mutations
<SELECT name="question60">
<OPTION value=na>
<OPTION value=A>sustained
<OPTION value=B>added
<OPTION value=C>confirmed
<OPTION value=D>prolonged
</SELECT>
the life of the worm by 400%.
</p>
<br>
<INPUT type="submit">
<br>
<br>
<input type=reset value=Clear>
</form>no.
you need to send the first set of options to a php page, which takes the 20 values from $_POST, and uses that to create a second page with the next 20 questions.
in the form for that, though, you can write a set of "hidden" inputs with the first 20 settings to pass onto the third page. The same thing happens there to get all 20 to the final page.
You can use the same PHP file, by using another parameter to say at which stage the user is at, again passed as a hidden value (which needs to be included in the original twenty questions).
a hidden value is put in a form as follows:
<input type='hidden' value='whatever' name='something_useful'>ok?br />but if you let the user choose the number of questions he wants to see how can you do that?
sorry i am new too at PHPwell, in that case, you keep passing the number of questions that the user requested, showing 20 on each page, and keep going until you have shown enough pages.
You are already keeping track of the number of pages you have displayed.<strong>Susan:</strong>Then why
sorry,couldn't quite folow that advice. Below are all the relevant parts of the code from index.html and from the .php page. Any chance you could indicate exactly where and what code I have to enter (to make the 3 seperate pages, putting a "next" button at the end of the first 2 and the submit at end of 3rd. thank you.
(code from index.html)...
<SELECT name="question20">
<OPTION value=na>
<OPTION value=A>you
<OPTION value=B>you did
<OPTION value=C>did you eat
<OPTION value=D>ate you
</SELECT>
3 sandwiches at 7am this morning?"
</p>
<SELECT name="question40">
<OPTION value=na>
<OPTION value=A>looking forward to
<OPTION value=B>looking forward
<OPTION value=C>to look forward
<OPTION value=D>look forward to
</SELECT>
hearing your explanation. </p>
<SELECT name="question60">
<OPTION value=na>
<OPTION value=A>sustained
<OPTION value=B>added
<OPTION value=C>confirmed
<OPTION value=D>prolonged
</SELECT>
the life of the worm by 400%.
</p>
(code from .php page)
<?php
$scoremax=60;
$score=0;
(questios 1,2,3 etc.etc....)
if ($_POST["question20"]=="C") $score++;
if ($_POST["question40"]=="D") $score++;
if ($_POST["question60"]=="D") $score++;
echo $score." answers correct ".$scorema." .";
// Mail things
etc. etc.
?>Pater,
I know I said I would help you out, but I just not had time.
I got hit with an impossible deadline thanks to the contracts guys not doing their jobs here. Hopefully someone else can help you out - if not I will be back in about a week.
If you PM to remind about this thread (don't send the question) NEXT friday, I'll try and have a look for you.pater, you have to split that html up into 3 pages.
that is the easiest way. you show 20 questions on the first page and it goes to a second php page with the next 20. in this second page you keep the answers they had to the first page in hidden form fields or a database or session. which ever one you prefer.
so you have 3 different php pages with 20 questions apiece.
what you showed will not help anybody out as it is incomlete.Thanks for all the help guys. I'm still learning about CSS etc. and hope to try your advice soon
i am working on it, gimme a week or two
but if somebody already has it it will save me some work sure
POST the answers from the first 20 questions to the next page, and put the values into hidden form inputs for the, which are then submitted with the next submit.um...I'm kinda new to php. Do you mean I can make the "hidden" changes in my index.html page, without changing the code in the .php page? Below is the end of the code in the index page. So, um...could you explain the steps a little more? Thanks.
...the combinations and mutations of the clock genes. Some gene mutations
<SELECT name="question60">
<OPTION value=na>
<OPTION value=A>sustained
<OPTION value=B>added
<OPTION value=C>confirmed
<OPTION value=D>prolonged
</SELECT>
the life of the worm by 400%.
</p>
<br>
<INPUT type="submit">
<br>
<br>
<input type=reset value=Clear>
</form>no.
you need to send the first set of options to a php page, which takes the 20 values from $_POST, and uses that to create a second page with the next 20 questions.
in the form for that, though, you can write a set of "hidden" inputs with the first 20 settings to pass onto the third page. The same thing happens there to get all 20 to the final page.
You can use the same PHP file, by using another parameter to say at which stage the user is at, again passed as a hidden value (which needs to be included in the original twenty questions).
a hidden value is put in a form as follows:
<input type='hidden' value='whatever' name='something_useful'>ok?br />but if you let the user choose the number of questions he wants to see how can you do that?
sorry i am new too at PHPwell, in that case, you keep passing the number of questions that the user requested, showing 20 on each page, and keep going until you have shown enough pages.
You are already keeping track of the number of pages you have displayed.<strong>Susan:</strong>Then why
sorry,couldn't quite folow that advice. Below are all the relevant parts of the code from index.html and from the .php page. Any chance you could indicate exactly where and what code I have to enter (to make the 3 seperate pages, putting a "next" button at the end of the first 2 and the submit at end of 3rd. thank you.
(code from index.html)...
<SELECT name="question20">
<OPTION value=na>
<OPTION value=A>you
<OPTION value=B>you did
<OPTION value=C>did you eat
<OPTION value=D>ate you
</SELECT>
3 sandwiches at 7am this morning?"
</p>
<SELECT name="question40">
<OPTION value=na>
<OPTION value=A>looking forward to
<OPTION value=B>looking forward
<OPTION value=C>to look forward
<OPTION value=D>look forward to
</SELECT>
hearing your explanation. </p>
<SELECT name="question60">
<OPTION value=na>
<OPTION value=A>sustained
<OPTION value=B>added
<OPTION value=C>confirmed
<OPTION value=D>prolonged
</SELECT>
the life of the worm by 400%.
</p>
(code from .php page)
<?php
$scoremax=60;
$score=0;
(questios 1,2,3 etc.etc....)
if ($_POST["question20"]=="C") $score++;
if ($_POST["question40"]=="D") $score++;
if ($_POST["question60"]=="D") $score++;
echo $score." answers correct ".$scorema." .";
// Mail things
etc. etc.
?>Pater,
I know I said I would help you out, but I just not had time.
I got hit with an impossible deadline thanks to the contracts guys not doing their jobs here. Hopefully someone else can help you out - if not I will be back in about a week.
If you PM to remind about this thread (don't send the question) NEXT friday, I'll try and have a look for you.pater, you have to split that html up into 3 pages.
that is the easiest way. you show 20 questions on the first page and it goes to a second php page with the next 20. in this second page you keep the answers they had to the first page in hidden form fields or a database or session. which ever one you prefer.
so you have 3 different php pages with 20 questions apiece.
what you showed will not help anybody out as it is incomlete.Thanks for all the help guys. I'm still learning about CSS etc. and hope to try your advice soon