This is my link: http://projects/timp#?period=2014-6-25
Obviously this code :
$period = $_GET['period']; echo $period;
does not work . What can i do ?
This is my link: http://projects/timp#?period=2014-6-25
Obviously this code :
$period = $_GET['period']; echo $period;
does not work . What can i do ?
Change the format of the URLs so that you don't have the #
in the middle. It does seem quite weird to have a ?name=value after the #
...
You can't directly get the hash since it won't reach to the server, you can probably do a workaround. Try something like this:
(Don't forget to append the hash on the url) #?period=2014-6-25
<?php
if(isset($_POST['submit'])) {
$hash = $_POST['hash'];
$hash = str_replace(array('#', '?'), '', $hash);
parse_str($hash, $url);
$period = $url['period'];
echo $period; // 2014-6-25
}
?>
<form method="POST">
<input type="hidden" name="hash" value="" />
<input type="submit" name="submit" />
</form>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
var hash = window.location.hash;
$('input[name="hash"]').attr('value', hash);
});
</script>