[clug] need another set of eyes - PHP when no variable is passed

Cody Miller cody.miller at aeria-networks.com.au
Thu Mar 30 03:33:55 GMT 2006


It should actually read:

if ( !isset($_GET['menu']) ) $_GET['menu'] = 'home';

On Thu, 30 Mar 2006 14:19:09 +1100, Cody Miller <cody.miller at aeria-networks.com.au> wrote:
> 
> This should do the trick :)
> 
> if ( !isset($_GET['menu']) ) $menu = 'home';
> 
> Cheers,
> Cody Miller
> 
> 
> On Thu, 30 Mar 2006 14:10:41 +1100, "Kristy A. Bennett"
> <kristy at kristy.id.au> wrote:
>> Okay,
>>
>> It's just one of those days >:o
>>
>> Okay so here's the dilemma.  I have a page - say index.php which has a
>> variable 'menu' to be passed back to itself.  This variable is then used
>> to call in flash movie (yeah, yeah I know....).  This part was working
>> and but I have since broken it again.  However, the problem does not lie
>> here.
>>
>> I cannot for the life of me work out how to set a default variable if
>> one is not passed (eg user goes to index.php as opposed to
>> index.php?menu="about").
>>
>> I have tried if(!$menu) {blah} and if ($menu=="") {blah}.  Neither work
>> - is there any other solution that I have just simply overlooked?
>>
>> --
>>
>> KrisB
>>    *****
>> Another Linux Hacker Production Unit
>> http://www.kristy.id.au
>>         *****
>>
>> --
>> linux mailing list
>> linux at lists.samba.org
>> https://lists.samba.org/mailman/listinfo/linux
> 
> --
> linux mailing list
> linux at lists.samba.org
> https://lists.samba.org/mailman/listinfo/linux



More information about the linux mailing list