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'
);
}
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
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 -
3 matches
Mail list logo