CREATING A DYNAMIC ONLINE GALLERY them (we ll work
CREATING A DYNAMIC ONLINE GALLERY them (we ll work out how to display them in rows of two later). Activating the link for each thumbnail requires a little more thought. You need a way of telling the page which large image to display. Passing information through a query string In the last section, you used $mainImage to identify the large image, so you need a way of changing its value whenever a thumbnail is clicked. The answer is to add the image s filename to a query string at the end of the URL in the link like this: You can then check whether the $_GET array contains an element called image. If it does, change the value of $mainImage. If it doesn t, leave $mainImage as the filename from the first record in the result set. Time to dive back into the code . . . PHP Solution 12-2: Activating the thumbnails Continue working with the same file as in the previous section. Alternatively, use gallery_mysql03.php, gallery_mysqli03.php, or gallery_pdo03.php from the download files. 1. Locate the tag surrounding the thumbnail. It looks like this: Change it like this: MySQL5 Web Hosting services.