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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Advice on best approach to this problem please.

Status
Not open for further replies.

LEICJDN1

Technical User
Nov 27, 2002
201
GB
Hi all,

Need to implement some new bits to my site. I am thinking I may need to use Forms in HTML which I have yet to play with. However, also want to add a few other bits, so some general advice on how to tackle this problem would be appreciated so I don't get halfway down one road before having to turn back (if you see what I mean).

So, what I would like to do is set up pages with multiple choice questions, which are then 'marked'

One page will have a question like this mock up:

1 Is Tek Tips the best? T F
2 Is it free to use T F
3 Are there better sites? T F
4 Will this problem be solved? T F

--------
| Mark |
--------

THe T and F would be radio buttons for that question - in other words you can only check either T or F for each question.

Then, once all ticked, clicking on a button would report a score out of four based on the buttons checked. It would also display a new page with explanatory answers.

So, can the above be constructed with an html form? As regards the marking, can that be done in plain HTML. I have dabbled in Javascript so that may be an option (with lots of clues).
Am too much of a beginner to think about database websites, server side includes, php, asp etc. at this stage, so hoping the above may be feasbile in HTML / JS.

All help much appreciated.

JDN
 
I'd do the form in HTML and have the form call as ASP page. I realize you said you're new to this, but the ASP code you'd need to get the values from the form and determine what is displayed on the following page is very easy stuff.

For example, you could retrieve answers from question one like this:

<%
If Request.Form(&quot;QuestionOneTF&quot;) = &quot;on&quot; Then
Response.Write &quot;You chose answer A. Answer A means...&quot;
Else
Response.Write &quot;You chose Answer B. Answer B means...&quot;
End If
%>

Hopefully this makes sense. If you do some searches on Request.Form and Response.Write, you should be in good shape to at least try it.

Good luck!
 
Thanks TomMc

had a feeling it would not be doable in HTML.

Have created the form without problems.

Can I ask a question about ASP - do I need to arrange anything with my server to set up ASP use or is it functional on all servers (it's basically a modified use of VB script right?)

THanks, must go and find the ASP forum (if there is one)

JDN
 
Fear not the idea of a &quot;form&quot;, for it is really quite a simple beast. It is simply a wrapper/identifier around HTML components -- usually controls -- that includes some bonus things, such as an action (the thing that happens when you hit [return] or press the Submit button).

If your quiz is that simple, you can do it all on the client side using JavaScript. Actually, you can do pretty complex quizzes, still with JavaScript, especially if they're all on the same page.

Oh and if you're just going to do a 2-state radio button (T/F), you can save yourself a bit of coding headache by using a checkbox, which is inherently Boolean. You would rephrase your questions slightly. For example:

Tek Tips is the best? [ ]
Tek Tips is free to use? [ ]
There are better sites? [ ]
This problem will be solved? [ ]

Checked is TRUE, not checked is FALSE. Cuts your control count in half.

Hope that helps!

Cheers,


[monkey] Edward [monkey]

&quot;Cut a hole in the door. Hang a flap. Criminy, why didn't I think of this earlier?!&quot; -- inventor of the cat door
 
Thanks for the encouragment. Dived right in and sorted out the form, works well.

Now need to work on the 'marking' solution. Wondered whether it could all be done with client side scripting, but as I aim to develop a large bank of questions, perhaps ASP would be more flexible?

 
Hi Mark, I have done a lot of work with automated self-scoring test where the answers are evaluated and e-mailed to the tester.

I have found the best approach is to use radio buttons which lends itself to be extended to multiple-choice as well as true/false.

On the server side the given answer values, 111 (in this case) can be retrieved and placed in an array and compared in a loop to a correct answer key (also placed in an array).


<html><head><title>TEK-TIPS Question</title></head>
<body>
<form name=&quot;MyQuiz&quot; method=&quot;post&quot;
enctype=&quot;multipart/form-data&quot; action=&quot;evalans.php&quot;>
1. Tek-Tips is the best?<br />
<input name=&quot;A01&quot; type=&quot;radio&quot; value=&quot;1&quot; />True<br />
<input name=&quot;A01&quot; type=&quot;radio&quot; value=&quot;2&quot; />False<br /><br />
2. Tek-Tips is free to use<br />
<input name=&quot;A02&quot; type=&quot;radio&quot; value=&quot;1&quot; />True<br />
<input name=&quot;A02&quot; type=&quot;radio&quot; value=&quot;2&quot; />False<br /><br />
3. There are better sites?<br />
<input name=&quot;A03&quot; type=&quot;radio&quot; value=&quot;1&quot; />True<br />
<input name=&quot;A03&quot; type=&quot;radio&quot; value=&quot;2&quot; />False<br /><br />
<input value=&quot;Submit Answers&quot; type=&quot;submit&quot; />
<br /></form></body></html>

Hope that helps!


Clive
 
Thank you for that form code. It is similar to my attemtp but a lot neater and simpler!

Can I ask what you use to compare the results with the forms output? ASP or PHP.

Am looking into ASP, but although my server claims to support ASP I cannot get a basic ASP page to work yet.

Thanks again.

JDN
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top