franzwarning Posted March 11, 2011 Share Posted March 11, 2011 Hi, I want to be able to click on the photo and go to the next one in a folder. I have this code already, I just am not quite sure how to finish it. -George <?php $count = $_GET['count']; $dir = "images"; $names = array(); $handle = opendir($dir); while ($name = readdir($handle)){ if(is_dir("$dir/$name")) { if($name != '.' && $name != '..') { echo "directory: $name\n"; } } elseif ($name != '.DS_Store' ) { $names[] = $name; } } closedir($handle); $numberofitems = count($names); $numberofitems--; if ($count <= $numberofitems){ echo "<p>"; echo "<img src='images/".$names[$count]."'>"; } else {echo "end";} ?> Quote Link to comment Share on other sites More sharing options...
mattal999 Posted March 11, 2011 Share Posted March 11, 2011 Well, you simply need a hyperlink incrementing the $count variable. Replace: echo "<img src='images/".$names[$count]."'>"; With: echo "<a href='?count=".($count + 1)."'><img src='images/".$names[$count]."'></a>"; Quote Link to comment Share on other sites More sharing options...
franzwarning Posted March 11, 2011 Author Share Posted March 11, 2011 You just made my day. Quote Link to comment Share on other sites More sharing options...
mattal999 Posted March 11, 2011 Share Posted March 11, 2011 You just made my day. Glad I could help 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.