How do I sum up answers on an HTML Web-based form?
- 0
- Add a Comment
Dave, I just want to add numbers together, get an answer, and retrieve a document represented by the answer. I have 11 pages for people to answer “yes” or “no” on. I have my “yes” and “no” buttons working properly. What I need to do is assign numerical values to each button on each page. Then I need to add the values of all 11 pages of each button pushed to get one answer. I want to use this answer to retrieve one document to be displayed for the viewer. Maybe you know of some tricks that can be used in HTML to do this. I was thinking if I can’t do it in HTML, maybe javascript might be an answer.
You pose an interesting question. The easiest way to solve this, I think, is to produce a small CGI script that modifies each of the 11 pages as sent so that they’re actually all forms. Then the answers to each question are simply the sum value to that point in the 11 questions plus the point value for that particular answer to the question.
This type of approach could be used to ascertain a Myers-Briggs personality profile, for example, where a set of questions would be used to determine which of each possible alternative pair applies best to the visitor (e.g., “introvert”, or “extrovert”, etc).
For example, if your fourth question is “Swallows are the fastest bird” and the two possible answers are “yes” (worth 2 points) and “no” (worth 1 point), and the person is going into this question with a sum value of 7 points, it could be structured thusly…
