Código PHP:
<?
include('conex.php');
$linea="SELECT * FROM menu";
$result=mysql_query($linea);
$menu = "\n";
while ($row = mysql_fetch_array($result))
{
$linea2="SELECT * FROM submenu WHERE id_menu='".$row['id_menu']."'";
$result2=mysql_query($linea2);
$cant = mysql_num_rows($result2);
$m=$row['url'];
if($cant == 0)
{
$menu .= "<li><a href=$m>".$row['name']."</a></li>\n";
}
else
{
$menu .= "<li id=services>\n <a href=$m>".$row['name']."</a>\n <ul id=subMenu>\n";
while ($row2 = mysql_fetch_array($result2))
{
$submenu=$row2['description'];
$varid=$row2['id_menu'];
$menu .="<li><a href=enviar.php?var1='$submenu'&var2='$varid'>".$row2['name']."</a></li>\n";
}
$menu.=" </ul></li>\n";
}
}
$menu .="";
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Vertical Navigation Menu: CSS3 Coded</title>
<link rel="stylesheet" href="styles.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
</head>
<body>
<div id="wrapper">
<ul class="menu">
<?
echo $menu;
?>
</div>
<script type="text/javascript">
$(function() {
var menu_ul = $('.menu > li > ul'),
menu_a = $('.menu > li > a');
menu_ul.hide();
menu_a.click(function(e) {
e.preventDefault();
if(!$(this).hasClass('active')) {
menu_a.removeClass('active');
menu_ul.filter(':visible').slideUp('normal');
$(this).addClass('active').next().stop(true,true).slideDown('normal');
} else {
$(this).removeClass('active');
$(this).next().stop(true,true).slideUp('normal');
}
});
});
</script>
</body>
</html>
Código PHP:
$menu .="<li><a href=enviar.php?var1='$submenu'&var2='$varid'>".$row2['name']."</a></li>\n";
os adjunto el texto html de los frames para que lo veais.
Código HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd"> <html> <head> <title>KeePass</title> </head> <frameset rows="70,*" frameborder="0" border="0" framespacing="0"> <frame name="top" src="top.html"> <frameset cols="230,*" frameborder="0" border="0" framespacing="0"> <frame name="menu" src="menu.php" marginheight="0" marginwidth="0" scrolling="auto" noresize> <frame name="content" src="content.html" marginheight="0" marginwidth="0" scrolling="auto" noresize> <noframes> <p>This section (everything between the 'noframes' tags) will only be displayed if the users' browser doesn't support frames. You can provide a link to a non-frames version of the website here. Feel free to use HTML tags within this section.</p> </noframes> </frameset> </frameset> </html>