Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to access anchors in a querystring via PHP?

I have a page that is accessed via a URL like this:

http://power-coder.net/Test/something.php?id=3#Page1

I know how to access the id parameter using $_GET, however is there a way for me to access the #Page1 part? I have looked at the $_SERVER array and the REQUEST_URI ends at ?id=3.

I know that I could also change the #Page1 to be an additional parameter like &Page=1, however there is a fair bit of code using the old URL type that I would like to avoid re-writing if at all possible.

Thanks for the help.

like image 830
Wally Lawless Avatar asked Jan 23 '23 21:01

Wally Lawless


1 Answers

No, there isn't a way. The fragment part (the label after #) is not transmitted to the server.

The browser retrieve the document http://power-coder.net/Test/something.php?id=3 and then go to the correct anchor (if there is one) in the document.

like image 182
Eineki Avatar answered Jan 26 '23 10:01

Eineki