• 0
Votes
name

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191

Backtrace:

File: /var/www/html/cnasolution/application/views/question.php
Line: 191
Function: _error_handler

File: /var/www/html/cnasolution/application/controllers/Questions.php
Line: 419
Function: view

File: /var/www/html/cnasolution/index.php
Line: 315
Function: require_once

I am trying to build a web-based quiz app. Broadly, the app will choose an html page at random, and a user will submit answers based on an image (the quiz app is on geography). Depending on the slide, there may be different numbers of questions.

So I have a function that I want to be able to do this (pseudocode):

get html page from list
navigate to it
user answers questions
app collects questions and moves onto next page
loop through all html pages

On previous web programs I had html pages that looked like this:

{% extends "layout.html" %}  {% block title %}     Europe {% endblock %}  {% block main %}     
{% endblock %}

And I collected the answers with the following type of code:

q1 = request.form.get("q1") q2 = request.form.get("q2") 

However, because all of my slides will have different number of questions I want to get the answers individually. Ideally, I want to query one form and get all the answers returned to me in a dictionary.

Is there a way to do this?

I'm using flask and python for this project.

Download script demo [LINK]
Download script demo [LINK 2] Download script demo [LINK 2]