Home > Software engineering >  Boostrap 4 menu dropdown not showing completely using it in include
Boostrap 4 menu dropdown not showing completely using it in include

Time:01-20

I made a menu with bootstrap and php. It works fine but when I use it with an include in another php file the dropdown items are not seen. I don't know if I'm missing a div or should I use something else?

this is my menu.php code:

<body>

 <nav >
   <ul >
      <!-- Brand/logo -->
      <li >
         <a  href="#" id="navbardrop" data-toggle="dropdown">Administracion</a>
         <div >
          <a  href="ajuste.php">Ajuste Cota</a>
          <a  href="estaciones.php">Estaciones</a>
          <a  href="panel.php">Panel de Control</a>
          <a  href="permisos.php">Permisos</a></div>
      </li>
      <li >
         <a  href="#" id="navbardrop" data-toggle="dropdown">Medicion</a>
         <div >
           <a  href="">Puesto 1</a>
           <a  href="">Puesto 2</a>
           <a  href="">Puesto 3</a>
         </div>
      </li>
   </ul>
</nav>

</body>

and this is how I use this in another php file

<body>

 <?php include("menu.php");?>
<br>
<div >
.
.
.
</body>

I should see the menu as follows:

menu.php:

enter image description here

But when I use menu.php in other file (as include) the menu item does not diplay

menu.php used as include file:

enter image description here

Can someone guide me how to fix this?

CodePudding user response:

Too many <body> tags...you should only have one set (<body>...</body>) in your whole page. You don't need them in the menu file if that's going to be included in another file.

  •  Tags:  
  • Related