I have seen on many sites using PHP some sort of id system where they can have a main page and then have different ids that will display completely different content. I am just wondering how you do this as I am in the process of making a screenshots gallery on my site. So lets say I go to example.com/image.php so that will take me to that page and then that would have 10 image thumbnails.

So when I click on them it will open up another dynamic page with only that image in so the url would be example.com/images.php?image=1. I have absolutely no clue how to do this, so if anyone can help with this probably it would be greatly appreciated.

Recommended Answers

All 3 Replies

In short line this is just way your PHP to recognize some ID .
with id= your PHP is getting the id of your gallery/ or id of some Database record and gets its information from your database..

Its using $_GET php function. in this case

example.com/images.php?image=1

$_GET["image"] will be equal to 1
after your script get this ID -1 it can collect information about the image with that id from your database and get it to the users.

commented: Excellent advice! +0

Oh, that makes sense but say the thumbnails are a link how would I use the get method?

you must store in some way the information about your picture (id, location, thumb location) perhaps the best way is with Mysql database.
and to select the records from this database WHERE the id of your database record is equal to this $_GET.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.