I'm having trouble retrieving a dyamic URL with two $_GET values. One of the $_GET values is the page number so a typical URL will look like this; I want to retrieve the whole URL without the page number! If I use "$_SERVER['PHP_SELF']" then it doesn't retrieve the value of "value1" and the result is this: I tried to use "$_SERVER['REQUEST_URI']" which got the whole URL below, but I don't want the "&page=1" bit. I need the URL so I can add the page number at the end depending on what the user selects and so far I have found this solution; $myvalue = $_GET['value1']; $viewurl = $_SERVER['PHP_SELF']."?value1=".$myvalue; PHP: This solution gives me the URL minus the page number in the "$viewurl" variable, and it works fine, but is it the best/correct way of doing it? Regards, --Mike
Thanks for your input, but did you even bother reading my post? If you did then you would know that I tried that and didn't get the result I wanted.
I dont see your GET call for page ? $myvalue = $_GET['value1']; $mypage = $_GET['page']; $viewurl = $_SERVER['PHP_SELF']."?value1=".$myvalue."&page=".$mypage; PHP:
opps then its $myvalue = $_GET['value1']; $viewurl = "http://".$_SERVER['SERVER_NAME']."".$_SERVER['PHP_SELF']."?value1=".$myvalue; PHP:
I think I figured this out for myself. The whole purpose of extracting part of the current URL is to input it into a hyper-link. If I include the two values in the quote above then it will give me a <b>absolute URL<b>. But as the script is only used to generate hyper-links within the same domain/server, excluding the above two values would simply make the "$viewurl" value into a relative URL. For this case it doesn't make any difference, but if anyone reading this wants to make external hyperlinks - make sure you use MyVodaFone's version. Thanks MyVodaFone. --Mike
If you get any problem then just type: print_r($_SERVER); // to get each and every server request print_r($_GET); // to get each and every GET type request print_r($_POST); // to get each and every POST type request similarly $_FILE also works. They all print the data in array form enabling you to get every information you need while operating.