PHP is server side. (Hang with me a minute, now....)
If you want to know if a link has been clicked with PHP, you have to do it intuitively. That is, you put a button in a form, or you create a link with the proper query string, and you write PHP code that handles this action on the server; either a handling script (for a form) or a dynamic script that reads query strings and acts appropriately.
So, it's quite possible that whatever it is you want to do (branching menus, sounds like) can be done with PHP.
But the subject of your post is "Testing if a link is clicked." There's a way to do this on the client side ... it's Javascript. You may want to think about that.
HTH,