Jump to content


Photo

Getting Current Page Name and Parameters


  • Please log in to reply
5 replies to this topic

#1 barkster

barkster
  • Members
  • PipPipPip
  • Advanced Member
  • 194 posts

Posted 22 June 2006 - 08:07 PM

How do I get the pagename and any parameters that are in the url? I can get the pagename with basename($_SERVER['PHP_SELF']); but it doesn't catch any parameters like pagename.php?lookhere=True

Thanks

#2 Eric_Ryk

Eric_Ryk
  • Members
  • PipPipPip
  • Advanced Member
  • 104 posts

Posted 22 June 2006 - 08:19 PM

[!--quoteo(post=386950:date=Jun 22 2006, 04:07 PM:name=barkster)--][div class=\'quotetop\']QUOTE(barkster @ Jun 22 2006, 04:07 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
How do I get the pagename and any parameters that are in the url? I can get the pagename with basename($_SERVER['PHP_SELF']); but it doesn't catch any parameters like pagename.php?lookhere=True

Thanks
[/quote]
$_GET["lookhere"] would automatically contain the value of True. Use $_GET to get any variables from the URL.

#3 barkster

barkster
  • Members
  • PipPipPip
  • Advanced Member
  • 194 posts

Posted 22 June 2006 - 09:29 PM

I understand how to get parameters I want the get the url including the parameters. Not just the parameter. I want to get the filename and any parameters that are appended.

#4 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 23 June 2006 - 02:51 AM

$_SERVER["REQUEST_URI"] should contain what you're looking for.
$_SERVER["QUERY_STRING"] contains the just the query string, i.e. the part after the "?", but not including the "?".

Ken

#5 michaellunsford

michaellunsford
  • Members
  • PipPipPip
  • Advanced Member
  • 1,023 posts
  • LocationLouisiana, USA

Posted 23 June 2006 - 05:06 AM

good reference:
[a href=\"http://us3.php.net/manual/en/reserved.variables.php\" target=\"_blank\"]http://us3.php.net/manual/en/reserved.variables.php[/a]

#6 barkster

barkster
  • Members
  • PipPipPip
  • Advanced Member
  • 194 posts

Posted 25 June 2006 - 05:54 PM

Thanks that was what I was looking for.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users