mac57;10895327 wrote:I am a PHP newbie. I am trying to figure out how to query and get the URL that invoked your page and any of the extra parameters that have been added to the end of that URL.
The issue here is one of URL rewriting. Many pages get invoked with extra stuff tacked on to the end of the URL, such as:
www.mypage.php?extra_parm1=1&extra_parm2=5
I would like to figure out how to get at the main URL (www.mypage.php) and the "extra_parm1" and "extra_parm2" values that have been tacked onto the end of the main URL (www.mypage.php). Is there some sort of built in function in PHP that can get at each of these values as a string, or in some other way?
Any and all help MUCH appreciated. Thanks.
Hi All, I thought I would post the solution for the benefit of other newbies like me.
Getting at the extra_parm values turns out to be pretty simple, without the need of any more complex structures like sessions.
When they are encoded per the above:
www.mypage.php?extra_parm1=1&extra_parm2=5
the receiving page (www.mypage.php) can access them as:
$GET['extra_parm1'] and $GET['extra_parm2']
I have tested this an it works on both PHP 4.4.8 and on PHP 5.2.6.
Hope this helps!