-1

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
  • 16,073
  • 6
  • 81
  • 79
rj tubera
  • 747
  • 4
  • 29
  • 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,680
  • 5
  • 37
  • 44
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,341
  • 1
  • 24
  • 40