Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

URL variable passing with missing variable 2

Status
Not open for further replies.

Zych

IS-IT--Management
Apr 3, 2003
313
US
Hello Everybody,

I have a page in which I want to pass in variables via the URL. This part is easy. The question I have is if no variable is passed. If none is passed I want to set it to Null. How can I do this only when no variable is passed?

For instance if I have a site setup to take this:


I know I have the variable referingid but if somebody does the following:


Then there is no variable passed so I want to set referingid to Null.

Thanks,

Zych
 
In the receving page default the varaibles to something before you try to access them

Code:
$local_var = '';

if(!empty($_GET['var'])){
$local_var = $_GET['var'];
}//end if

Bastien

I wish my computer would do what I want it to do,
instead of what I tell it to do...
 
[tt]isset($_GET['referingid'])[/tt] will return true or false depending if $_GET['referingid'] is set or not.

Cheers.
 
Thanks for both of your answers. They work like a charm!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top