i passing below url in address bar
www.example.com/latest_notes/?shareURL&adherentID=ascd#123 i want get the after # value of 123 this page i have tried SERVER function i can able to get UL without #, Please any one help
i passing below url in address bar
www.example.com/latest_notes/?shareURL&adherentID=ascd#123 i want get the after # value of 123 this page i have tried SERVER function i can able to get UL without #, Please any one help
Convert the url string to a PHP url object with the function parse_url and dereference its "fragment" key like this:
$url=parse_url("www.example.com/latest_notes/?shareURL&adherentID=ascd#123");
echo $url["fragment"];
The above code returns 123
Take a look at the function parse_url, it does what you need. http://php.net/manual/en/function.parse-url.php
$url = 'http://username:password@hostname:9090/path?arg=value#anchor';
var_dump(parse_url($url));
var_dump(parse_url($url, PHP_URL_SCHEME));
var_dump(parse_url($url, PHP_URL_USER));
var_dump(parse_url($url, PHP_URL_PASS));
var_dump(parse_url($url, PHP_URL_HOST));
var_dump(parse_url($url, PHP_URL_PORT));
var_dump(parse_url($url, PHP_URL_PATH));
var_dump(parse_url($url, PHP_URL_QUERY));
var_dump(parse_url($url, PHP_URL_FRAGMENT));
You need the #anchor values: use the last line of code
var_dump(parse_url($url, PHP_URL_FRAGMENT));
Possible duplicate question Get fragment (value after hash '#') from a URL in php