I have two arrays. One array is a list of image file paths and the other is a list of image titles matched with the array of image files.The code generates a display of images accompanied by the appropriate image title.
What I want to be able to do is to select one of the displayed images which will then act as a link to a different page. I wish also to generate a session variable based on the file path of the clicked image.
I've researched quite a lot but am beginning to wonder if this can be done, or should I be working on a completely different approach. I am a beginner. Here is my code.
<ul>
<?php
foreach (array_combine($filepaths, $titles) as $filepath => $title) { ?>
<li><img src=<?php echo "$filepath";? ></li>
<li><?php echo $title; ?></li>
<li></li>
<?php }?>
</ul>