Determine if url has variables contained

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
john_crawford32
Forum Newbie
Posts: 9
Joined: Mon Mar 31, 2003 7:56 pm
Location: East Berlin, PA
Contact:

Determine if url has variables contained

Post by john_crawford32 »

Hi all, is there a search function on this list?
I am sure this is an easy one but not for me.
I have an index page that the first time visited has no url variables (coldfusion term) but after selecting a nav link it has them ie.
first time http://www.mydomain.com
second http://www.mydomain.com?content=calendar

I am trying to determine if content is set or not using the following code

Code: Select all

if (isset($HTTP_GET_VARSїcontent]))
{
$contentpage = $HTTP_GET_VARSїcontent].".php";
if ($contentpage == "sub.php")
{
$contentpage = "subscriptions.htm";
}
}
else
{
$contentpage = "start.php";
}
I get an error
Notice: Use of undefined constant content
How do I determine if the content variable exists or not?
Thanks
John
john_crawford32
Forum Newbie
Posts: 9
Joined: Mon Mar 31, 2003 7:56 pm
Location: East Berlin, PA
Contact:

Post by john_crawford32 »

Pebkac,
I forgot the quotes yes i am a newbie.

Code: Select all

if (isset($HTTP_GET_VARSї'content']))
User avatar
protokol
Forum Contributor
Posts: 353
Joined: Fri Jun 21, 2002 7:00 pm
Location: Cleveland, OH
Contact:

Post by protokol »

At least you were able to solve the problem ;-)

You are well on your way young grasshopper.
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

As for the search function, it's here:
search.php

(there's a link to it amongst the links above the ImHosted banner)

Mac
Post Reply