Member Avatar for karthik_ppts

How to get all the query-string parameters with php_self function?

Member Avatar for vibhaJ

You can get query string parameter using $_GET.

echo '<pre>'; print_r($_GET);
Member Avatar for karthik_ppts

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']
Member Avatar for vibhaJ

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); }
Member Avatar for karthik_ppts

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.