PDA

View Full Version : PHP PHP <ul><li> MENU PROBLEM



drummer392
June 26th, 2009, 06:36 PM
Hey, I am trying to use this code:



<?php

# Connect to the database

// Get the categories
$cat_result = mysql_query('SELECT catid, category FROM category;');

// Loop through the categories
while ($category = mysql_fetch_assoc($cat_result))
{
// Write the category header
echo "<div id='dhtmlgoodies_slidedown_menu'>";
echo "<ul><li><a href='#'>{$category[category]}</a><ul>";

// Get the pages belonging to the category
$page_result = mysql_query("SELECT id, title FROM pages WHERE catid={$category[catid]};");

while ($page = mysql_fetch_assoc($page_result))
{
echo "<li>{$page[title]}</li>";
}
echo "</ul></li></ul></div>";
}
?>


and use it with this tutorial using demo 1: http://www.dhtmlgoodies.com/index.html?whichScript=slidedown_menu2

When I apply the coding with the PHP it doesn't work, but if I just slap a their menu in their it works fine. Does anyone know what is going on cause I can't figure this out.

irrationalistic
June 26th, 2009, 06:45 PM
Are you getting any php errors or do you have any more info about what doesn't work?

drummer392
June 26th, 2009, 06:51 PM
Are you getting any php errors or do you have any more info about what doesn't work?

I am not getting any PHP errors. Just the menu slide down effect that is supposed to happen works without PHP, but when I integrate in with PHP like I have in the code, it doesn't work at all.

irrationalistic
June 26th, 2009, 10:31 PM
Can you show the resulting HTML? Maybe something is missing?

drummer392
June 27th, 2009, 04:12 AM
<div id='dhtmlgoodies_slidedown_menu'><ul><li><a href='#'>Forensic Engineering</a><ul><li>TRying!</li></ul></li></ul></div>

Nevo
June 27th, 2009, 08:20 AM
Just compare what's different with when PHP generates it to when you write it in HTML.

Make sure you're including all the right js files as well.