Hello,
I designed a survey with 48 questions and I want them to be randomly rotated. It works but once the questions are finished, the survey indicates a completion rate of 50% and it shows the questions again together with the answers provided.
I used the following code:
if (!isset($questions)) {
$questions = array( // list of question IDs
'TR01',
'TR02',
'TR03',
'TR04',
'TR05',
'TR06',
'TR07',
'TR08',
'TR09',
'TR10',
'TR11',
'TR12',
'TR13',
'TR14',
'TR15',
'TR16',
'TH01',
'TH02',
'TH03',
'TH04',
'TH05',
'TH06',
'TH07',
'TH08',
'TH09',
'TH10',
'TH11',
'TH12',
'TH13',
'TH14',
'TH15',
'TH16',
'SA01',
'SA02',
'SA03',
'SA04',
'SA05',
'SA06',
'SA07',
'SA08',
'SA09',
'SA10',
'SA11',
'SA12',
'SA13',
'SA14',
'SA15',
'SA16'
);
// shuffle list randomly
shuffle($questions);
registerVariable('questions');
}
$i = loopPage(count($questions));
question($questions[$i]);
What I am doing wrong?
Thank you in advance for your help.