Forums

Multiple Question Quiz with assigned marks per answer (radio buttons)

ulyssues.fam 09 Dec, 2018
Hi everyone, I am building a quiz with 10 questions. Each question has 3 answers a user can select from. All answers are correct and are assigned a value e.g.

2=answer a
4=answer b
6=answer c

What the purpose of this quiz is, is to sum up the values from the whole quiz (not show them to the user), request a user for name, surname, email and country, and then redirect to a specific page based on the points collected e.g.
If a user got a total between 16-28 points he/she is redirected to www.results1.com
If a user got a total between 29-32 points he/she is redirected to www.results2.com
If a user got a total between 33-48 points he/she is redirected to www.results3.com

Now, I've set up the quiz, questions, answers, section for email etc and I am stuck with saving the value of each question and adding the value of each next question so that I can finally sum it up and send him/her to a specific website.

Any ideas on how to get there? I've already set up the database for that, and I guess it has to do with DB save, but how to I add each value of each question into a total? (I've also created a field in the database called quiz_total, in order to add the values in there).
healyhatman 09 Dec, 2018
Call all the fields a variation of

quiz[field_name]

Then in submit use PHP

$total = array_sum($this->data("quiz"));
healyhatman 09 Dec, 2018
Also if you're sending the values as form data, user can just right click, inspect, and see all the values
ulyssues.fam 12 Dec, 2018
Hey there, thanks healyhatman for your reply!

I've sent you a pm, please check it out.

Thanks!
ulyssues.fam 12 Dec, 2018
Regarding sending the values as form data, I guess a possible solution is this:
https://www.chronoengine.com/forums/posts/t98408/assign-numerical-values-to-radio-buttons-in-a-quiz?keywords=quiz
This topic is locked and no more replies can be posted.