a.beam.reach Posted May 4, 2017 Share Posted May 4, 2017 I am currently using the following code to return a page that displays all the pictures within a folder: echo''; $array=glob('ebayimg/9150gba041117/size_2/*'); foreach($array as $zf) echo '<img src="http://www.gbamedical.com/'.$zf.'">’; I need to be be able to do similar to the below code. . . only, there needs to be two occurrences of each picture in the code and I need to dynamically add the word "image1, image2, etc" for however many pictures are in the folder. . . . as shown below. The below example shows just two pictures but I need it to return code for however many pictures are in the folder. <div class="slider"> <input type="radio" name="slide" id="image1" checked/> <label for="image1"> <img src="http://www.gbamedical.com/ebayimg/9150gba041117/size_2/IMG_9633.JPG"/> </label> <img src="http://www.gbamedical.com/ebayimg/9150gba041117/size_2/IMG_9633.JPG" height="480"/> <input type="radio" name="slide" id="image2"/> <label for="image2"> <img src="http://www.gbamedical.com/ebayimg/9150gba041117/size_2/IMG_9638.JPG"/> </label> <img src="http://www.gbamedical.com/ebayimg/9150gba041117/size_2/IMG_9638.JPG" height="480"/> </div> Thanks in advance for any help you can offer me! Trevor Link to comment Share on other sites More sharing options...
codignrockz Posted May 5, 2017 Share Posted May 5, 2017 Try this: <div class="slider"> <?php $array=glob('ebayimg/9150gba041117/size_2/*'); foreach($array as $zf){ ?> <input type="radio" name="slide" id="<?php echo $zf ;?>" checked/> <label for="image1"> <img src="http://www.gbamedical.com/ebayimg/9150gba041117/size_2/<?php echo $zf ;?>"/> </label> <img src="http://www.gbamedical.com/ebayimg/9150gba041117/size_2/<?php echo $zf ;?>" height="480"/> <?php } ?> </div> Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.