PHP variable, current page with parameters

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Slason
Forum Newbie
Posts: 5
Joined: Thu Jan 26, 2012 3:44 pm

PHP variable, current page with parameters

Post by Slason »

Is there a variable that contains the current page with parameters?

For example, the

Code: Select all

$_SERVER['PHP_SELF'];
only contains the current page, but I would like it to contain the current URL parameters as well. In this instance I want it to contain "?id=1" as well, but to use something like

Code: Select all

$_SERVER['PHP_SELF']."?doChangePass=true&id=1"
is not what I want, since there are different paramters at different times.
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: PHP variable, current page with parameters

Post by social_experiment »

$_SERVER['QUERY_STRING'] contains the query string in the url; have a look at this url for more information
http://www.php.net/manual/en/reserved.v ... server.php
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
Slason
Forum Newbie
Posts: 5
Joined: Thu Jan 26, 2012 3:44 pm

Re: PHP variable, current page with parameters

Post by Slason »

Thx for a quick reply. Works perfectly now.
Post Reply