0

I am getting my current page URL in variable using following code.

echo $url=$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
// Result: mywebsite/webpage.php

Everything goes well till here. But my webpage.php has some internal links. Which make URL like this

http://mywebsite/webpage.php#fragment-1

So when user is on this page and refresh page. I need to have fragment-1 in Result too but it shows same result as earlier. So how can I get '#fragment-1' value from url ?

coder
  • 119
  • 8
  • 2
    and this http://stackoverflow.com/questions/940905/can-php-read-the-hash-portion-of-the-url – HamZa Apr 19 '13 at 07:27

1 Answers1

2

You can't. Hashes do not get sent to the web server.

Mischa
  • 42,876
  • 8
  • 99
  • 111
pfyod
  • 617
  • 5
  • 11