specific selection from an array, outputting the rest
Posted: Fri Jun 17, 2005 11:43 am
Ok im a bit stuck. I am making a page which displays 4 images. One image is the main image which is large, and the other three are thumbnails. I have a function which dynamically makes thumbnails, so all i have in my database is the location fo the four images. When someone clicks on one of the thumbnails i want that image to become large and the previous image to go into the thumbnails. Here is what i have so far.
Ive yet to use arrays but this seems to be a good case in using them. Im not to sure what functions i should use here, and how i should setup the loop.
I appreciate all your responses
Regards
-soianyc
Code: Select all
<?php
$picarray = array($row['mainpic'],$row['backpic'],$row['sidepic'],$row['profpic']);
list($mainpic,$backpic, $sidepic, $profpic) = $picarray;
$piccount = count($picarray);
echo '<a href="arraytest.php?menuID='.$menuID.'&itemID='.$itemID.'&picID='.$picID.'"><img src="pix/resize2.php?image='.$picID.'" alt="www.treschicfurs.com" /></a>';
echo '</div>';
echo '<div id="subpic">';
echo '<ul>';
echo '<li class="subpic"><a href="arraytest.php?menuID='.$menuID.'&itemID='.$itemID.'&picID='.$backpic.'"><img src="pix/resize3.php?image='.$backpic.'" /></a></li>';
echo '<li class="subpic"><a href="arraytest.php?menuID='.$menuID.'&itemID='.$itemID.'&picID='.$sidepic.'"><img src="pix/resize3.php?image='.$sidepic.'" /></a></li>';
echo '<li class="subpic"><a href="arraytest.php?menuID='.$menuID.'&itemID='.$itemID.'&picID='.$profpic.'"><img src="pix/resize3.php?image='.$profpic.'" /></a></li>';
?>Ive yet to use arrays but this seems to be a good case in using them. Im not to sure what functions i should use here, and how i should setup the loop.
I appreciate all your responses
Regards
-soianyc