Creating dynamic links to load in same window

hey folks, as i m new to php and a newbie, as i m working on a website which have many thumbnails in photo gallery i needed to know how can i make them dynamic using php so when a image is clicked. its respective image open. here is there html which i m using now (unfinished)

					<div class="gallery">
                    <h2>Photo Gallery</h2>
						<a href="" onclick=""><img class="galleryimg" src="images/gallery/thumbs/1.png" /></a>
                        <a href="" onclick=""><img class="galleryimg" src="images/gallery/thumbs/PIC_0779.png" /></a>
                        <a href="" onclick=""><img class="galleryimg" src="images/gallery/thumbs/PIC_0835.png" /></a>
                        <a href="" onclick=""><img class="galleryimg" src="images/gallery/thumbs/3.png" /></a>
                        <a href="" onclick=""><img class="galleryimg" src="images/gallery/thumbs/Quake0127-July-05.png" /></a>
                        <a href="" onclick=""><img class="galleryimg" src="images/gallery/thumbs/PIC_2460.png" /></a>
                        <a href="" onclick=""><img class="galleryimg" src="images/gallery/thumbs/PIC_2461.png" /></a>
                         <a href=""><img class="galleryimg" src="images/gallery/thumbs/PIC_2462.png" /></a>
                          <a href=""><img class="galleryimg" src="images/gallery/thumbs/PIC_2462.png" /></a>
                           <a href=""><img class="galleryimg" src="images/gallery/thumbs/PIC_2467.png" /></a>
                    </div>

First step is to figure out whether you’re using a new-pageload (href) or a javascript call (onclick) to display the image.

Then we need to know how you’re retrieving the image list. Database call? Text? Instanced Array?

I’ll be using a HREF and I prefer arrays