I would like to be able to change different content on a page based on an anchor tag:
http://mydomain.com/mypage#conten1
http://mydomain.com/mypage#conten2
Can it be done with PHP? I’ve tried print_r($_GET) to see if I can get it that way, but certainly it does not work. Shall I use something like:
if (ereg("#content1",$REQUEST_URI)) {
// show content 1
}
…or is there a better way?
Thanks.
#can not be accessed by a server, it is not transmitted by browsers to the server!What you propably want to do is: to jump to a section on a page, you can simply do this with plain HTML:
An other solution would be to catch the link via JavaScript and trigger a request to the server. This is how facebook does it.