title: Javascript location hash into php variable
body: <p>Am trying to get the current URL that contains a hash e.g (<a href="http://www.example.com/index.php#folder23242%FNew" rel="nofollow noreferrer">http://www.example.com/index.php#folder23242%FNew</a>). 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.</p>
  
  <pre><code>echo '&lt;script&gt;
  var url = ""; 
  url = location.hash;
  url = decodeURI(url);
  document.cookie="currenturl=url";
  &lt;/script&gt;';
  $url = "";
  $url = $_COOKIE["currenturl"];
  $arr = explode('/', $url);
  $url = end($arr);
  
  echo "&lt;script&gt;alert('".$url."')&lt;/script&gt;";
  </code></pre>