$_GET screwing up with page identifiers

Simplistic example.

A header redirects to site.com/index.php#test?error=format

If I check for $_GET["error"] with that URL, it will not properly see the error $_GET there. If I remove #test, it will work. I need the page jumping though upon load though.

  1. Why is it like this?
  2. How can I jump to the part of the page WITHOUT JS (this is a JS-disabled scenario), and how can we also get $_GET to read right here.

Hi there Ryan,

Nothing after the hash(known as the fragment) ever gets seen serverside. For PHP to handle it, the var would need to be before the hash. Without JS, I don’t see a resolution other than changing the order of the var and fragment.

Derp…thanks.

Logically, to me, I thought I had to do #test?thing=thing. Not ?thing=thing#test. Appreciate the help.

Rule is URL#FRAGMENT. GET variables are part of URL, for example:

_http://shop.example.com/index.php?category=computers

So, with this example, logically you have to go in the right category of the shop first and only then scroll to required part of the page:

_http://shop.example.com/index.php?category=computers#bestsellers

Does it make sense?

Yes, with that example it makes sense. Thanks.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.