Page 1 of 1

Problem with PHP Menu

Posted: Wed Sep 06, 2006 10:31 am
by TKramer
I am using variables to display the correct navigation menu on my site. Everything appears to be working fine, except for one section of the menu, and for the life of me I cannot see what I am doing wrong.

At the top of each page, I define a variable: "pageid" and assign a number to it: 01-09.

Code: Select all

<?php
$pageid = 08;
?>
The navigation menu is an include file with 9 items, listed below is the code for 8 and 9.

Code: Select all

<?php
if ( $pageid == 08 ) {
	echo "<img src=\"images/menu_08_on.gif\" name=\"menu08\" width=\"173\" height=\"18\" alt=\"Getting Involved\" border=0><br>";
} else {
	echo "<A HREF=\"getting_involved.php\" onMouseover=\"menu08.src='images/menu_08_on.gif'\" onMouseout=\"menu08.src='images/menu_08_off.gif'\"><img src=\"images/menu_08_off.gif\" name=\"menu08\" width=\"173\" height=\"18\" alt=\"Getting Involved\" border=0></a><br>";
}

if ( $pageid == 09 ) {
	echo "<img src=\"images/menu_09_on.gif\" name=\"menu09\" width=\"173\" height=\"18\" alt=\"Home\" border=0><br>";
} else {
	echo "<A HREF=\"default.php\" onMouseover=\"menu09.src='images/menu_09_on.gif'\" onMouseout=\"menu09.src='images/menu_09_off.gif'\"><img src=\"images/menu_09_off.gif\" name=\"menu09\" width=\"173\" height=\"18\" alt=\"Home\" border=0></a><br>";
}
?>
The problem that I am having is that when the pageid variable is set to 08 or 09, it triggers the first "echo" for both items.

The web address is http://www.flatwatershakespeare.org/new/default.php

Thanks in advance for any help...

Anyone?

Posted: Wed Sep 06, 2006 11:33 am
by TKramer
Any thoughts?

Posted: Wed Sep 06, 2006 11:40 am
by Luke
be patient... don't bump. :evil:

Posted: Wed Sep 06, 2006 2:11 pm
by Mordred
That's a funny one ;))

08 and 09 are not valid numbers -- they all equal zero, and that's the core of your problem.

Numbers that start with 0 are considered to be in octal, which has digits from 0 to 7 only.

Thanks

Posted: Wed Sep 06, 2006 2:36 pm
by TKramer
Thanks for the answer! Really appreciate it.