Am trying to get the current URL that contains a hash e.g (http://www.example.com/index.php#folder23242%FNew). Anything after the hash the variable must store it in PHP variable. I have added the script but the PHP does not recognize the Javascript variable value and prints no value. I need it to take the Javascript variable so it can execute my php script.
echo '<script>
var url = "";
url = location.hash;
url = decodeURI(url);
document.cookie="currenturl=url";
</script>';
$url = "";
$url = $_COOKIE["currenturl"];
$arr = explode('/', $url);
$url = end($arr);
echo "<script>alert('".$url."')</script>";