Hi,
I am trying to work out how I can add a variable to PHP_SELF. I have a page in my catalogue which brings up data based on its address.
The address could be catalogue.php or catalogue.php?Genus=3 or catalogue.php?Genus=3&Division=2.
I am having problems because I am trying to add a paging function and can’t seem to get it to work. This is the code I am using:
$self = $_SERVER['PHP_SELF'];
Then later on in the code I am using something like this to provide the link:
$next = " <a href=\“” . $self . “page=$page\”>[Next]</a> ";
The problem I have is when the page is catalogue.php?Genus=3. For some reason PHP_SELF ignores the part after the question mark and so my link ends up being catalogue.php?page=2. I have tried adding an extra bit of code onto the link, using something like:
$self .="?Genus=3";
But then this ends up looking like this: catalogue.php?Genus=3?Page=2, which obviously doesn’t work. I have also tried using [REQUEST_URI] but this has a problem when you go onto another page as always adds to the address and I end up with something looking like catalogue.php?Genus=3&Page=2&Page=3&Page=4, etc., etc.
Does anyone know a way in which I can achieve this?