Search code examples
phpgetanchor

$_GET difference when calling URL with or without anchor


Why does $_GET deliver different results if I call an URL with an anchor compared to without?

example:

https://www.myurl.com/#anchor?param1=x&param2=y

if I read the GET params, REQUEST, $_SERVER['QUERY_STRING'], parse_url($url, PHP_URL_QUERY) all are emtpy

but with

https://www.myurl.com/?param1=x&param2=y

everything works as expected.

Can anyone explain me this please?


Solution

  • Anchors go at the end, hence the name. :)

    https://www.myurl.com/?param1=x&param2=y#anchor