[SOLVED] URL Question

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
Sphen001
Forum Contributor
Posts: 107
Joined: Thu Mar 10, 2005 12:24 pm
Location: Land of the Beaver

[SOLVED] URL Question

Post by Sphen001 »

Hi guys,

I'm wondering if you could help me with this question. Basically, I'm looking to examine a URL and determine if there is a query string attached. Basically, I want to do this:

Code: Select all

<?php
if($query_string)
{
  $url = $_SERVER['PHP_SELF'] . '&foo=bar';
}
else
{
  $url = $_SERVER['PHP_SELF'] . '?foo=bar';
}
?>
Thanks for any and all help :D

Sphen001
Last edited by Sphen001 on Tue Jul 12, 2005 10:02 pm, edited 1 time in total.
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

$_SERVER['QUERY_STRING']

:D
Sphen001
Forum Contributor
Posts: 107
Joined: Thu Mar 10, 2005 12:24 pm
Location: Land of the Beaver

Post by Sphen001 »

Thanks Burrito

That little tip triggered an idea. :D

Sphen001
Post Reply