title: call php function depending on website section
body: <p>I have a php website thats more or less like this. PHP noob here.</p>
  
  <p><strong>Index.php</strong></p>
  
  <pre><code>&lt;? 
  include('conexion.php');
  include('funciones.php');
  ?&gt;
  
  &lt;head&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
      &lt;?php
      if (!empty($_GET["palabra"])) {
        function1($conexion);     
      } elseif (!empty($_GET["letra"])) {
        include('letra.php');
      } elseif (!empty($_POST["buscar"])) {
        include('search.php');
      } else {
        function3($conexion);
      }
      ?&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>All functions fuctions and database connections are defined in the included files.</p>
  
  <p>Website uses only a single html file, so all the content is included or called by the functions. Is there a good way for the website to identify which "section"  or content is the user browsing?
  So, for example I want a function to run only when the user is using the search page, should I continue to use the REQUEST to identify what the user is doing? Should I insert a variable like $section and then if($section=search){dosomething()} or maybe using the URL? should I use another approach?</p>