Inhaltsverzeichnis

question()

void question(string questionID, array|string items, [string options])

Shows the question with the specified questionID in the questionnaire. The function question() is mainly used with Filters and Conditional Questions.

Tips

Note: Calling up the function question() is equivalent to the drag & drop of a question into the questionnaire. If you integrate the command question() into a question (e.g. in a filter) make sure that the same question is not put on the page again via drag & drop. Otherwise, the question appears twice.

Note: SoSci Survey differentiates between upper and low case for the ID and all options.

Note: Both the ID as well as other options must be quoted as a string; as a rule in quotation marks (single or double). Please see examples.

Tip: You can only show items dynamically that the participant selected in another question. For more details please see Use Selected Items in Another Question.

Tip: You do not have to type the question() command by hand. You can just drag & drop a question into a PHP code element. See Introduction to PHP Code: Comfortable Programming (Questions and Texts).

Examples

question('BS10');  // Daily television use
question('BS01', '2,1,4,5');  // items 2, 1, 4 and 5 are called up
question('NH02', 'random=3');  // 3 items selected at random
question('AA01', 'show-title=no');  // hide question title
 
// The following three lines each show items 1 to 4 and 6 in question BS07
question('BS07', array(1,2,3,4,6));
question('BS07', array('1-4',6));
question('BS07', '1-4,6');
 
question('SK01', 'spacing=4');  // Display a scale and directly beneath ...
question('SK02', '1', 'show-title=no');  // ... the first item of a free text input "Other: ___"