PHP Get the whole query string text from address bar


Previously in a comment a question was asked from me about how to get the text following the URL in title bar.

In PHP you can get the query string text with is separated by URL via '?' character. For this you can use 'query_string' with server variable.

So you can use it like


echo $_SERVER['QUERY_STRING'];
?>

So, for following URL in address bar:-
www.mobifonz.com?var1=3&var3=this

Output will be:-
var1=3&var3=this

And for following URL in address bar:-
www.mobifonz.com?this_Is_Some_Text

Output will be:-
this_Is_Some_Text

Means it will return anything after the '?' sign.

Posted in |