To get to PHP you'd have to get back to the server, so have that link go to another page, or to the same page (it would refresh the page). Put your parameters in the URL so you can get them back out on your next page.
<a href="somepage.php?id=2">click me</a>
Then somepage.php would be able to use $id to execute the query.
Or do you need more specific details?