manlio Posted August 31, 2017 Share Posted August 31, 2017 Hi to everybody. I'm building a short online quiz (10 questions - and for every question the page reload) and at the end of the quiz I need to present a summary of all correct and incorrect answers. Everyone can fill the quiz (the user doesn't need to be logged in and so any guest can access the quiz) and I would like to know if there is an easy way to store all the data so I'm able to read them at the end of the quiz. I tried to pass all post variables but I find it complicated because I need to pass everytime a lot of data, How could I store the data as PW pages and delete unnecessary data as soon as the process is finished? Is this a good idea? Thank you Link to comment Share on other sites More sharing options...
adrian Posted August 31, 2017 Share Posted August 31, 2017 Storing form/quiz/survey data in PW pages is great idea. I would even use the fields from the template that stores the data as the way to build the form that users will access on the frontend. After each question has been answered, add that answer to the appropriate field on the page and then reload with the next field/question. Obviously you could delete the page when you get to the end of the process, but honestly I would keep them - why not keep the data - you never know when you might find it useful As far as naming pages, I would go with the ID of the new page as the name and title. 1 Link to comment Share on other sites More sharing options...
Craig Posted August 31, 2017 Share Posted August 31, 2017 When I've needed to implement a multi-page process, I've stored the user's responses in the session, using the built-in ProcessWire Session handling code. If anything needs to be permanent at the end of the process, only then would I create the necessary pages. 1 Link to comment Share on other sites More sharing options...
Zeka Posted August 31, 2017 Share Posted August 31, 2017 Storing user data in a session is a good way, but if the question in collecting as much user data as possible I would save every answer on each step. In that way, I will have answers from not finished quizzes/surveys. 2 Link to comment Share on other sites More sharing options...
manlio Posted September 1, 2017 Author Share Posted September 1, 2017 Thank you all for your incredible support and for confirming that save in dB or in session variables is the good way to follow. If I choose the "save to pages" route, I am not sure how to plan the creation of the page. Should I create the page in the first step of the quiz and than pass the id page post variable to the following steps? In this way every time a guest refresh the first step of the quiz in the browser a new page would be created. Can this generate too many unuseful content and hit on server performance? Thank you again and sorry for the dump questions. Link to comment Share on other sites More sharing options...
adrian Posted September 11, 2017 Share Posted September 11, 2017 On 8/31/2017 at 11:19 PM, manlio said: Should I create the page in the first step of the quiz and than pass the id page post variable to the following steps? In this way every time a guest refresh the first step of the quiz in the browser a new page would be created. Can this generate too many unuseful content and hit on server performance? I would only create the page if the user answers the first step of the quiz (to avoid empty pages). And yes, I would pass the ID of the page to each successive step of the quiz. 2 Link to comment Share on other sites More sharing options...
manlio Posted September 11, 2017 Author Share Posted September 11, 2017 Thank you Adrian! You were really helpful. Have a nice day 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now