I have a PHP/mysqli generated form that uses ORDER BY rand()
in the mysqli query to randomise options in a decision task (using the code found here).
I came up with a way to validate the user input to match a predefined set of values (see answer for the linked question), which triggers a page reload if the validation conditions aren't met. However, this leads to the form table being generated using a different random order. I would like to display the form table in the same order as in the first page load using php. Additionally, I would like to echo
the user input values in the input fields (so the user can see what s/he entered).
Is there a relatively simple way I can achieve this? I've looked into using multidimensional arrays and storing the data in $_SESSION
, but none of the solutions seem to be applicable to this problem.