How to create a quiz that stores variables from page to page

Hello, everyone. My goal with Wappler is to create a webpage with a somewhat advanced quiz. Users will answer questions, the webpage will store variables based on user input, then give the user various results depending on what they select.

I understand that I’ll need a variable that will change depending on user input. However, right now I have each quiz page as a different html doc, and I’m not sure how to maintain variables from page to page.

I should mention that I’m pretty much a novice when it comes to programming. I was able to create the interactions I wanted using Adobe Captivate and Articulate Storyline, but was disappointed with the customization options, so I’m now turning to a more advanced tool, and I feel a little in over my head. Any resources out there that cover these steps from start to finish would be greatly appreciated, as a lot of these other forum posts seem to infer a greater understanding of these concepts.

Thanks!

Hi Ben and welcome to our community,
Please check the following tutorial explaining how to pass a variable from page to page:

1 Like

Fantastic, this was extremely helpful. There’s just one thing this tutorial doesn’t quite cover, and that is adding to session variables, not just changing them. For example, I have a category X, and whenever anyone clicks button Y on a page, X should increase by 1, so the final page displays how many times button Y was clicked. So far, I’m able to have button Y change X to 1, not add 1 to X each time.

I thought this might work for my button:

<button class="btn w-100 btn-light btn-lg h-auto" dmx-on:click="session1.set('fquizhsa',++,{});browser1.goto('FeatureQuiz3.html')">X</button>

but it just seems to set X to “+”. And yes, the variable for X is a number.

Thanks!

As far as I know, you can’t use ++ to increment variables. This should work:
dmx-on:click="session1.set('fquizhsa',session1.data.fquizhsa + 1,{});

2 Likes