troubleshooting Question

Why are my submenus appearing above the main menu?

Avatar of FairyBusiness
FairyBusinessFlag for United States of America asked on
15 Comments1 Solution343 ViewsLast Modified:
Hi, I am trying to output the submenus underneath each main menu that they belong to.   It outputs them just not in the right place.  The submenus appear above the regular menu:

function menu() {
	$menus = get_menu();
	$output = "";
	while($menu = mysql_fetch_assoc($menus)) {
		$output .= "<li><span></span><a href=\"" . $menu['blurb'] . ".php?menu=" . urlencode($menu['id']) . "\">" . 
					$menu['title'] . "</a>";
		echo submenus($menu['id']);
		$output .= "</li>";
	return $output;
function submenus($menu_id) {
	$submenus = get_submenu($menu_id);
	$output = "<ul class=\"ul_1\">";
	while ($submenu = mysql_fetch_assoc($submenus)) {
		$output .= "<li><a href=\"" . $submenu['blurb'] . ".php?submenu=" . urlencode($submenu['id']) . "\">" . $submenu['title'] . "</a>";
		// next submenus
		$output .= "</li>";
	$output .= "</ul>";
	return $output;

Open in new window

Any suggestions?

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 15 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 15 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros