kate_rose Posted December 28, 2007 Share Posted December 28, 2007 Hi, Is there a php function which allows me to load the name of the link into a variable when the link is clicked on? I am new at this but I have looked for quite a while & have not found a way to do it. I know you can get the url that visitors to your site come from but I am not sure how to modify that to get the link name or even if I could. Thanks for any help you can provide. Kate Quote Link to comment https://forums.phpfreaks.com/topic/83443-load-link-name-into-php-variable/ Share on other sites More sharing options...
Northern Flame Posted December 28, 2007 Share Posted December 28, 2007 do you mean if someone click and html link coded like this: <a href="http://yourwebsite.com">Your Website</a> you want to get "Your Website"? Quote Link to comment https://forums.phpfreaks.com/topic/83443-load-link-name-into-php-variable/#findComment-424513 Share on other sites More sharing options...
kate_rose Posted December 28, 2007 Author Share Posted December 28, 2007 Sort of but the link is to an internal anchor within the page. So I guess what I really want is the anchor name which is the same word/name as the link that you click on. Sorry if I wasn't clear at first Quote Link to comment https://forums.phpfreaks.com/topic/83443-load-link-name-into-php-variable/#findComment-424515 Share on other sites More sharing options...
corbin Posted December 28, 2007 Share Posted December 28, 2007 So like.... if you had: http://somesite.com/page.php#content1 You would to grab content1? If so, you probably want to look into the $_SERVER array especially the QUERY_STRING, REQUEST_URI and any other url related keys.... Edit: Bah... I had suspected this, so I looked into it and was right.... It appears that the # things are just client side (which makes sense), so there's no way to tell from the server what they are. I think javascript can read anchors though if that helps in some weird way. Quote Link to comment https://forums.phpfreaks.com/topic/83443-load-link-name-into-php-variable/#findComment-424533 Share on other sites More sharing options...
kate_rose Posted December 28, 2007 Author Share Posted December 28, 2007 I tried to reply here but somehow it became a new topic???? I guess you can't change the subject on this forum without it doing that. Anyway the new topic is better explanation. Quote Link to comment https://forums.phpfreaks.com/topic/83443-load-link-name-into-php-variable/#findComment-424539 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.