PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Hi, I have a function that displays the first image in a photo album in large and all the photos in it as thumbnails. I have a next and previous button that allows you to scroll through them (in large) and by clicking a specific thumbnail you can load that picture in large. My problem is that the pictures are stored in an array and the one to be shown large is selected by $keyid.
My problem is that selecting a thumbnail resets the $keyid so that clicking next doesn't load the next image but the second. i.e. if you press the next arrow then click the 4th thumbnail and then click the next arrow again it loads the 2nd picture rather than the 5th as it should.
Could you post the generateThumbnails code? It's hard to say definitively without seeing that code, all you may need to do is change your next and previous buttons to use $keyid instead of $_GET["keyid"]. This will work if you are updating that same $keyid when a thumbnail is selected.
Also, you need to make sure that $_GET["keyid"] and $_GET["thumb_selected"] have valid input. You check that $keyid is within a range but who ever said that it was in fact a number? And maybe thumb_selected is not a folder you expect it to be, maybe it's one with some more sensitive data.