switch case does not run

Asked

Viewed 34 times

-1

I have the following code:

<aside class="main-sidebar">
  <!-- sidebar: style can be found in sidebar.less -->
  <section class="sidebar">
    <!-- Sidebar user panel -->
    <!-- sidebar menu: : style can be found in sidebar.less -->
    <ul class="sidebar-menu" data-widget="tree">
      <li class="header">MENU</li>
      <li class="active treeview">
        <a href="?rotina=perfil">
          <i class="fa fa-dashboard"></i> <span>Dashboard</span>
        </a>
      </li>
      <li class="treeview">
        <a href="?rotina=profile">
          <i class="fa fa-user"></i>
          <span>Meu Perfil</span>
        </a>
      </li>
      <li>
        <a href="?rotina=curriculum">
          <i class="fa fa-laptop"></i> <span>Meus Cursos</span>
        </a>
      </li>
      <li>
        <a href="pages/widgets.html">
          <i class="fa fa-edit"></i> <span>Meu Curriculum</span>
        </a>
      </li>
    </ul>

  </section>

</aside>

  <?php 

    $tela = "";

    if(!isset($_GET['rotina'])){

      $tela = "homesys.php"; 

   } else {

    $rotina = $_GET['rotina'];

    switch($rotina) {

      case "profile":

        echo $rotina;

        // $tela = "perfil.php"; 
        break;    

      default: 
        $tela = "homesys.php"; 
        break;    

    }

  }

  ?>

  <div class="content-wrapper">

    <?php include_once("../views/$tela");?>

  </div>

When I click on the option My Profile, the switch case does not execute. Where is the error?

1 answer

2

You need to put the $screen variable between keys. Use the following code: <?php include_once("../views/{$tela}");?>.

And another, the passage $tela = "perfil.php"; within the "profile" case is commented in your code.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.