title: Bootstrap navbar dropdown not working only from one page
body: <p>I have a navigation bar with 3 button, saying Home, Films and Genres. Clicking the Genre should open the dropdown with the list of all Genres generated from database and on click to each genre, genrepage containing the list of films of selected genre shows up. But the Genre button (with dropdown) is not working when I am trying to access it from home page. But it works fine for any other pages. I am using Bootstrap 3.3.7 navbar and any help will be appreciated. </p>
  
  <p>My navbar.php</p>
  
  <pre><code>  &lt;?php
  
   /*
     array of pages
     this builds the navigation list
  
     format:
      filename =&gt; URL name
     */
     $navArray = array(
      'index'         =&gt; 'Home',
       'film'         =&gt; 'Films',
       'genre'            =&gt; 'Genre',
      );
  
      ?&gt;
  
  
      //some html code here
  
               &lt;?php 
               foreach($navArray as $key =&gt; $nav){ 
  
              //assign active class to currently active page
                  if(strstr($_SERVER['SCRIPT_NAME'], $key)) 
                      $active = ' active';
                  else $active = '';
  
                  //if Genre is selected, display dropdown menu
                  if($nav=='Genre'){
  
                      echo '&lt;li class="dropdown"&gt;&lt;a class="dropdown-toggle" data-toggle="dropdown" href="#"&gt;Genre&lt;span class="caret"&gt;&lt;/span&gt;&lt;/a&gt;
           &lt;ul class="dropdown-menu"&gt;';
  
  
  
              //generate dropdown from database, giving the list of genres
              $queryGenreList="SELECT genre.`name`
                              from genre;
                              ";
              $resultGenreList=$db-&gt;query($queryGenreList);
  
  
              if($resultGenreList-&gt;num_rows &gt; 0){
                  while($row = $resultGenreList-&gt;fetch_assoc()){
  
                  echo '&lt;li&gt;&lt;a href="genreInfo.php?name='.$row["name"].'"&gt;'.$row["name"].'&lt;/a&gt;&lt;/li&gt;';
  
                  }  
              }
              echo '&lt;/ul&gt;
              &lt;/li&gt;';
  
                  }
  
                  echo"&lt;li class='nav-item".$active.";'&gt;";
                  if($nav!='Genre'){
                      echo"&lt;a class='nav-link' href=".$key.".php&gt;".$nav."&lt;/a&gt;";
                  }
  
                  }
                  ?&gt;
  
  
          &lt;/li&gt;
  </code></pre>