2
Contributors
4
Replies
6
Views
6 Years
Discussion Span
Last Post by karthik_ppts
0

You can get query string parameter using $_GET.

echo '<pre>';
print_r($_GET);

Thanks for Your reply. I think my question is not understandable to u. Actually my need is to get full url with query string using php_self. I Got it through

$_SERVER['PHP_SELF']."?".$_SERVER['QUERY_STRING']
1

Okay...
$_SERVER was not working on live server in some of my past projects.
So i used below function.
Just sharing...

function getCurrPageUrl($unset=array())
{
	$currPageName = basename($_SERVER['PHP_SELF']);
	$arr = $_GET;
	foreach($unset as $one)
	{
		unset($arr[$one]);
	}		
	return $url = $currPageName.'?'.http_build_query($arr);
}
0

Okay...
$_SERVER was not working on live server in some of my past projects.
So i used below function.
Just sharing...

function getCurrPageUrl($unset=array())
{
	$currPageName = basename($_SERVER['PHP_SELF']);
	$arr = $_GET;
	foreach($unset as $one)
	{
		unset($arr[$one]);
	}		
	return $url = $currPageName.'?'.http_build_query($arr);
}

Ok.. Thanks for your sharing. Its really helpful to me.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.