-2

Hello if I have an href with #test=10, how can I get that value using codeigniter?

Example: I have www.example.com/tester#test=10

Is it possible to get the value of test?

Renaud
  • 15,164
  • 5
  • 76
  • 77
rj tubera
  • 727
  • 4
  • 28
  • 51

2 Answers2

1

Try using php

$url=parse_url("http://domain.com/#test=10 ");
echo $url["fragment"];

if url fregment test=10 then use explode()

$e = explode('=', $url["fragment"]);
echo $e[1];

or using javascript

alert(window.location.hash); and split it

For more :- Get fragment (value after hash '#') from a URL in php

Community
  • 1
  • 1
Rakesh Sharma
  • 13,570
  • 4
  • 35
  • 42
0

I don't think php can get that value alone. $_SERVER['query_string'] or similare skip the hash.

  • You can use window.location.hash in javascript and then send it to php (various way).
  • Use apache to create an environment variable that contain the hash
  • Use apache to rewrite hash into url for php to get it
Cyrbil
  • 6,250
  • 1
  • 23
  • 38