My website URL is something like the below:
http://localhost/naveendalmeida/news.php#news_6
How can I get the URL to include #news_6 using PHP or JavaScript.
My website URL is something like the below:
http://localhost/naveendalmeida/news.php#news_6
How can I get the URL to include #news_6 using PHP or JavaScript.
window.location.href
should return what you need (javascript).
Getting it in php seems a little more verbose:-
For php parse_url function is utilized for parsing url
For retrieving fragment part of url through parse_url function
e.g
$url_info=parse_url($url);
echo $url_info['fragment'];