i write < ? php
if(isset($_REQUEST['id'])){
echo $_REQUEST['id'];
} ? >
< a href="#id=3" > click < /a >
But I didn't get the value of id.. How can i get it?
I don't think you can do it since the string after #
is interpreted by the browser as anchor name so it'll not being passed to the server.
You cannot do that with php, because the value after hash cannot send to server. You can use js to send it to server like;
var hash = window.location.hash;
$.get("get_hash.php?hash=" + hash, function(response) {
// handle response
});
in get_hash.php
:
$hash = $_GET['hash']; //#id=4
$remove_hash = substring($hash, 1, strlen($hash) - 1); //id=4
$id_arr = explode("=", $param_arr[1]); // 0=> id, 1=> 4
echo "id=" . $id_arr[1]; // 4
Try this for getting the value of last parameter.
$url = "localhost/gft/wp-admin/admin.php?page=abc-yu#id=4";
$last = end(explode("=",$url));
echo $last;