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