title: PHP: Dynamic Pages with multiple dynamic content
body: <p>I'm using this a particular code to dynamically load content on a webpage. </p>
  
  <p>Problem is, I want to use it to load multiple things on the same page. How do I go about making this possible? I've already isolated the problem to the fact that the second instance of the code that runs replaces the entire URL instead of appending an additional <code>?="pageurl"</code> but I'm stuck right there. </p>
  
  <p>I've got a second script that uses the variable <code>p</code> instead of <code>b</code> so the browser knows to load <code>p</code>'s content in a different location.</p>
  
  <p>This is what the code does: 
  <a href="http://www.youtube.com/watch?v=Qg-EBdNaUbo" rel="nofollow">http://www.youtube.com/watch?v=Qg-EBdNaUbo</a></p>
  
  <p>[edit] </p>
  
  <p>Not sure why you guys can't see the link, it explains everything. I'm calling the script via a link  Here is the link again youtube.com/watch?v=Qg-EBdNaUbo </p>
  
  <p><strong>CODE:</strong></p>
  
  <pre><code>&lt;?php
  
  $pages_dir = 'pages';
  
  if(!empty($_GET['b']))
  {
  
      $pages = scandir($pages_dir, 0);
      unset($pages [0], $pages [1]); 
      $b = $_GET['b'];
  
      if(in_array($b, $pages))
          {
          include($pages_dir.'/'.$b); 
          }
      else
          {
          echo 'sorry page not found';
  
          }
              }
  else 
      {
      }   
  
  ?&gt;
  </code></pre>