-1

I have a url like this http://example.com/?hello=1234

using this

   ob_start();
   var_dump($_GET);
   $result = ob_get_clean();
   print_r($result);

i get this

 array(1) {
 ["hello"]=>
 string(3) "123"
 }

but when it comes to http://example.com/#hello=1234 im getting nothing. i know that # is for client side/browser but is there any way to get everything after the # (hash tag) ?

mwweb
  • 7,625
  • 4
  • 19
  • 24

3 Answers3

3

The URL fragment is not sent to the server at all.

You can access it in client-side Javascript using location.hash.

SLaks
  • 868,454
  • 176
  • 1,908
  • 1,964
0

var hash = location.hash.slice(1) in JavaScript will get you everything after the #.

For http://example.com/#hello=1234 var hash would be hello=1234

xphong
  • 1,114
  • 2
  • 13
  • 20
-2

You either have to parse the url using parse_url() or use javascript instead window.location.hash

Aram
  • 361
  • 3
  • 10