The only issue with scallions way is you will probably have sub scripts later.. Waht I mean is this

//code executed when you first hit page
else if($cmd == "redirect_after_selection"){
//code to execute once user clicks said such link
so you links would be like so

replace ( with < and you get the idea

(a href="url_to_script/script.php?cmd=redirect&" target="_self")
text or image link here
Quick question, if you do not have the URL in your database.... Where will the user get it from? Or are you going to have all URLs re-routed through this..
My New site OpenEyes