I have an rather simple php code which I would like to change into an loop (if possible). Otherwise the code will be too long at the end. Unfortunately I am not really familiar with php (the code is for an Online questionaire).
if (value('X001_03') == 1) {
question('VAR', array(1));
} elseif(value('X001_03') == 2) {
question('VAR', array(1,2));
} elseif(value('X001_03') == 3) {
question('VAR', array(1,2,3));
} elseif(value('X001_03') == 4) {
question('VAR', array(1,2,3,4));
} elseif(value('X001_03') == 5) {
question('VAR', array(1,2,3,4,5));
} elseif(value('X001_03') == 6) {
question('VAR', array(1,2,3,4,5,6));
} elseif(value('X001_03') == 7) {
question('VAR', array(1,2,3,4,5,6,7));
} elseif(value('X001_03') == 8) {
question('VAR', array(1,2,3,4,5,6,7,8))
}
Basically the number after == has to increment by "1" until it reaches 9, while the range of the arrays increases at the same time.
Thankful for any help!
Best regards
range()might help...