RE: [PHP] How do I stop foreach if $menu not set??

2002-06-11 Thread Lazor, Ed
Change introduction to a variable with $ in front of it or put it in quotes introduction. What Can I do to stop the foreach function from working if $menu is not set?? ? if ($menu==(introduction)) {$sub = array( 'overview.php' = 'Overview', 'moreinfo.php' = 'More Info' ); }

Re: [PHP] How do I stop foreach if $menu not set??

2002-06-11 Thread Stuart Dallas
On Tuesday, June 11, 2002 at 10:59:13 PM, you wrote: I Have worked out this, but when $menu is not set it does the foreach function anyway, and desplays an error. What Can I do to stop the foreach function from working if $menu is not set?? http://www.php.net/isset -- Stuart -- PHP

Re: [PHP] How do I stop foreach if $menu not set??

2002-06-11 Thread hugh danaher
You should be able to contain your foreach statement within an if statement: if (isset($menu)) { foreach ($sub as $link = $name) ( $sublink .= lia href='.$link.'.$name./a/libr; } else { print menu variable not set } Hope this helps. Hugh - Original Message -