freelancer Posted September 30, 2009 Share Posted September 30, 2009 Hello! I have form where I enter for example picture file names like this: test1.jpg, test2.jpg, test3.jpg etc. Now on page where I want these images to be displayed I need to explode them so let's say I have $picture[0], $picture[1], $picture[2] etc. My question and problems that how I can make them appear as seperate links depening on how many pictures were exploded to variables so i.e. when I have 2 images names in sql table then on my web it displays like www.test.com/test1.jpg, www.test.com/test2.jpg etc. Maybe explode isn't only solution and there could be any other ways to do it. Hope you understand my point and can help me! Quote Link to comment Share on other sites More sharing options...
5kyy8lu3 Posted September 30, 2009 Share Posted September 30, 2009 explode will work. <?php $pics = explode(',', $_GET['pics']); $NumberOfPictures = count($pics); $location = 'http://www.YourWebSite.com/pictures/'; for ( $i = 0; $i < $NumberOfPictures; $i++ ) { echo $location . $pics[$i] . '<br>'; } ?> that would echo out a link for each picture, but i'm not completely sure that's what you were asking, it wasn't very clear. Quote Link to comment Share on other sites More sharing options...
freelancer Posted September 30, 2009 Author Share Posted September 30, 2009 Thanks that was exactly what I was looking for! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.