Willkommen im Online-Support von SoSci Survey.

Hier bekommen Sie schnelle und fundierte Antworten von anderen Projektleitern und direkt von SoSci Survey.

→ Eine Frage stellen


Welcome to the SoSci Survey online support.

Simply ask a question to quickly get answers from other professionals, and directly from SoSci Survey.

→ Ask a Question

0 votes

Dear SoSci users,
I am currently facing an issue related to PHP echo function to call images from an array.
My goal is to create an array of images (already uploaded), shuffle the images (array elements) and call them on by one on separate questions later in the questionnaire following the order given by "shuffle".

Here the code:
Page 1 (creating array + shuffle):

$images = array (
    'blue.png',
    'green.png',
    'purple.png',
    'red.png', );

shuffle($images);

Page 2 (first question):

foreach ($images as $image) {
    echo '<div class="image-entry">';
    echo "\t" . '<img src="' . $image . '" />';
    echo '</div>'; }

Page 3 (second question):
Here I would call the second image in the array and so on.,

However echo function is not allowed on SoSci because it would crush the html code.
Open to suggestions and comments!
Thank you

in SoSci Survey (English) by s093160 (200 points)

1 Answer

0 votes

you can use the function html('') instead of echo. You can find the documentation here: https://www.soscisurvey.de/help/doku.php/en:create:functions:html

by s109993 (5.6k points)
...