i getting issue fetch current url .php?id=1 get id
i am using this code
$query = $_SERVER['PHP_SELF'];
$path = pathinfo( $query );
$what_you_want = $path['basename'];
get .php but not get id
i getting issue fetch current url .php?id=1 get id
i am using this code
$query = $_SERVER['PHP_SELF'];
$path = pathinfo( $query );
$what_you_want = $path['basename'];
get .php but not get id
$_SERVER['REQUEST_URI']
For more details on what info is available in the $_SERVER
array, see the PHP manual
If you also need the query string (the bit after the ? in a URL), that part is in this variable:
$_SERVER['QUERY_STRING']
Use GET to get the value of id . You don't need to use $_SERVER['PHP_SELF'].
$id = $_GET['id'];
you can try this code
function curPageURL() {
$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {
$pageURL .= "s";
}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .= $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . $_SERVER["REQUEST_URI"];
} else {
$pageURL .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
}
return $pageURL;
}