Forum Moderators: coopster
Looking at:
http://example.com?a=123&b=456&c=789#111
I am trying to get vale for "c" and everything behind it, ie c=789#111 .
$_SERVER['QUERY_STRING']
or
$HTTP_SERVER_VARS["QUERY_STRING"]
produces everything but #111 (and I really want that part as well)
Any help is greatly appriciated
$arr = explode("#",$_SERVER['REQUEST_URI']);
print_r($arr); //$arr[1] will be the value after hash sign
also you might want to print
print_r($_SERVER); this will show you at least one option that you can use to get the complete posted URL.
I am guessing that most of my troubles are not being able to get *complete* URI of the current page.
No, actually, the problem is you are *only* getting the complete URI of the page. The # symbol says, 'anchor' to a browser, and is (correctly) not passed as part of the URI/URL.
If $_GET['c'] does not work, you will need to change the character.
Information following the # should not be passed as part of the URI (maybe if you can 'escape it' by encoding, but I don't think so), because it is a browser message, not part of the location, and should not be interpreted or used by the server.
http://example.com?a=123&b=456&c=789#111
What the above 'says' is: 'Open the website example.com, pass the information a=123&b=456&c=789 to the location example.com, and jump to anchor 111 (<a name="111"></a>) on the page.'
Justin
I don't know if I would recommend using a 'standard' php comment symbol as part of a passed variable anyway.
Might be better to use a different character.
If you need to set the location, you could probably pass the same information twice: a=123&b=456&c=789&d=111#111