如何根据搜索结果选择数据点击mysql?

Title was a little hard to write clearly so let me explain. I am using PHP and have made the scripts to search a database and output that data in a html table using a loop. http://imgur.com/89ORrv9 example there.

All is good here but I am not to sure how to go about the following.

I want to set some global variables such as searchfname based on the link you click on the table.

I will add a hyperlink tag to the id section but how do I upon clicking that link set the global variables to the value of the other columns such as First Name and Surname.

Can I somehow grab the value of the link and use that in a query to find the details?

Any help would be appreciated thanks in advance.

Luke.