Easily done and is the basics of server side programming.
Your link for picture a will be href="thepage.php?pic=a". When a user clicks on that link, they will be taken to thepage.php! That page will have a $_GET['pic'] variable with the value a. Of course, the value can change, which is why it's called a variable, but you use this to generate a page depending on what the person has selected!