A Switch does not work [php]

0

                 INTRA-Nielsen | Scheduling

<link rel="stylesheet" href="/dist/css/styles.css">
<!-- Tell the browser to be responsive to screen width -->
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<!-- Bootstrap 3.3.5 -->
<link rel="stylesheet" href="/bootstrap/css/bootstrap.min.css">
<!-- Font Awesome -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
<!-- Ionicons -->
<link rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
<!-- Theme style -->
<link rel="stylesheet" href="/dist/css/AdminLTE.min.css">
<!-- AdminLTE Skins. Choose a skin from the css/skins
     folder instead of downloading all of them to reduce the load. -->
<link rel="stylesheet" href="/dist/css/skins/_all-skins.min.css">
<!-- iCheck -->
<link rel="stylesheet" href="/plugins/iCheck/flat/blue.css">
<!-- Morris chart -->
<link rel="stylesheet" href="/plugins/morris/morris.css">
<!-- jvectormap -->
<link rel="stylesheet" href="/plugins/jvectormap/jquery-jvectormap-1.2.2.css">
<!-- Date Picker -->
<link rel="stylesheet" href="/plugins/datepicker/datepicker3.css">
<!-- Daterange picker -->
<link rel="stylesheet" href="/plugins/daterangepicker/daterangepicker-bs3.css">
<!-- bootstrap wysihtml5 - text editor -->
<link rel="stylesheet" href="/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css">

<link rel="stylesheet" href="https://cdn.datatables.net/1.10.15/css/jquery.dataTables.min.css">
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/1.3.1/css/buttons.dataTables.min.css">

<link rel="stylesheet" type="text/css" href="calendario/dhtmlgoodies_calendar/dhtmlgoodies_calendar.css?random=20051112">
<link rel="stylesheet" type="text/css" href="calendario/css/ui-lightness/jquery-ui-1.7.2.custom.css">
<script type="text/javascript" src="calendario/dhtmlgoodies_calendar/dhtmlgoodies_calendar.js?random=20060118"></script>

<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->

  

<div class="wrapper">
    <!-- DIV FLOTANTE FRENTE DE PAGINA -->
    <section>
        <div id="capa_modal" class="div_modal" onclick="javascript:cerrar_div_modal()"></div>
        <div id="capa_para_edicion" class="div_contenido"></div>
    </section>

    <!-- Encabezado pagina -->
    <?php
        session_start();
        if (!empty($_SESSION['iduser']))
        {
            include('../../home_header.php');
        }else{
           header("location:/index.php");
        }
        session_write_close();
    ?>

    <!-- Menu Principal -->      
    <aside class="main-sidebar">
        <section class="sidebar">
        <?php
            include('../../home_menu.php');
        ?>
        </section>
    </aside>

    <!-- Contenido Central de Pagina -->
    <div class="content-wrapper">
        <div id="content-sidebar">
            <?php 
                $iduser=$_SESSION['iduser'];
                $op=$_GET['turno'];

                switch ($op) {
                    case 'listado1':        include('dash_turnos.php'); break;
                    case 'listado2':        include('dash_carga-turnos.php'); break;
                    case 'listado3':        include('dash_turno-propio.php'); break;
                    case 'listado4':        include('dash_turno-dia.php');break;
                    case 'listado5':        include('dash_asigna-ejecutivo.php');break;
                    default:                include('home.php');break;


                             }
            ?>
        </div>
    </div><!-- /.content-wrapper -->



    <!-- Pie de Pagina -->
    <?php 
        include('../../home_footer.php');
    ?>  

    <!-- Barra Lateral Derecha -->
    <?php 
        include('../../home_control_sidebar.php');
    ?>


    <!-- Add the sidebar's background. This div must be placed
    immediately after the control sidebar -->
    <div class="control-sidebar-bg"></div>

</div><!-- ./wrapper -->

<!-- jQuery 2.1.4 -->
<script src="/plugins/jQuery/jQuery-2.1.4.min.js"></script>
<!-- jQuery UI 1.11.4 -->
<script src="https://code.jquery.com/ui/1.11.4/jquery-ui.min.js"></script>
<!-- Resolve conflict in jQuery UI tooltip with Bootstrap tooltip -->

 <script>
  $.widget.bridge('uibutton', $.ui.button);
</script>
<!-- Bootstrap 3.3.5 -->
<script src="/bootstrap/js/bootstrap.min.js"></script>
<!-- Morris.js charts -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/raphael/2.1.0/raphael-min.js"></script>

<!-- DataTables -->
<!--<script src="/plugins/datatables/jquery.dataTables.min.js"></script>
<script src="/plugins/datatables/dataTables.bootstrap.min.js"></script>-->

<script src="https://cdn.datatables.net/1.10.15/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.3.1/js/dataTables.buttons.min.js"></script>
<script src="//cdn.datatables.net/buttons/1.3.1/js/buttons.flash.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
<script src="//cdn.rawgit.com/bpampuch/pdfmake/0.1.27/build/pdfmake.min.js"></script>
<script src="//cdn.rawgit.com/bpampuch/pdfmake/0.1.27/build/vfs_fonts.js"></script>
<script src="//cdn.datatables.net/buttons/1.3.1/js/buttons.html5.min.js"></script>
<script src="//cdn.datatables.net/buttons/1.3.1/js/buttons.print.min.js"></script>

<!-- Sparkline -->
<script src="/plugins/sparkline/jquery.sparkline.min.js"></script>
<!-- jvectormap -->
<script src="/plugins/jvectormap/jquery-jvectormap-1.2.2.min.js"></script>
<script src="/plugins/jvectormap/jquery-jvectormap-world-mill-en.js"></script>
<!-- jQuery Knob Chart -->
<script src="/plugins/knob/jquery.knob.js"></script>
<!-- daterangepicker -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.2/moment.min.js"></script>
<script src="/plugins/daterangepicker/daterangepicker.js"></script>
<!-- datepicker -->
<script src="/plugins/datepicker/bootstrap-datepicker.js"></script>
<!-- Bootstrap WYSIHTML5 -->
<script src="/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.min.js"></script>
<!-- Slimscroll -->
<script src="/plugins/slimScroll/jquery.slimscroll.min.js"></script>
<!-- FastClick -->
<script src="/plugins/fastclick/fastclick.min.js"></script>
<!-- AdminLTE App -->
<script src="/dist/js/app.min.js"></script>
<!-- AdminLTE dashboard demo (This is only for demo purposes) -->

<!-- AdminLTE for demo purposes -->
<script src="/dist/js/demo.js"></script>

<script src="/js/sidebar.js"></script>
<script src="../agendamiento_ordenes/ajax.js"></script>

The cases work until 4, I tried entering break after doing the include of each case but it did not work.

And here are the classes, to show that the names are identical and it's not a problem of names.

At the time of loading the page corresponding to list 5, does not show anything on the screen or even shows an echo or anything like that, I infer that it is not reaching the case because in the url it indicates ..

  

/home_dash_turnos.php?turno=5   

    
asked by felipe andrade 27.07.2017 в 17:03
source

1 answer

0

EDIT

Since apparently what you said was a mistake, debug in these two levels.

1st Check the value of $op :

$op=$_GET['turno'];
echo $op;

If it is 5 , verify that it is not a five with blank spaces or something like that: 5(espacio) or (espacio)5 ...

2nd Check that it is not a problem with the file you are including:

case 5: echo "5"; break; //include('dash_asigna-ejecutivo.php');break;

3º Add default at the end, to see if option 5 is not fulfilled: '

At the end of the switch:

default: echo "Por defecto. Op tiene el valor: ".$op;

@deprecated

As you say:

  

When loading the page corresponding to list 5, it does not show   nothing on the screen does not even show an echo or anything like that,   I deduce that it is not reaching the case because in the url it indicates   ../ home_dash_turnos.php? turn = listing5

In that case, the value of $op=$_GET['turno']; will be listing5 , but you evaluate like this:

  switch ($op) {
                case 1:        include('dash_turnos.php'); break;
                case 2:        include('dash_carga-turnos.php'); break;
                case 3:        include('dash_turno-propio.php'); break;
                case 4:        include('dash_turno-dia.php');break;
                case 5:        include('dash_asigna-ejecutivo.php');break;
               }

In that context, there is no case 5, but a case listado5 .

Or, you even match the code to respond like this:

../home_dash_turnos.php?turno=5

Or you add that possibility to the case:

case "listado5":  include('dash_asigna-ejecutivo.php');break;
    
answered by 27.07.2017 в 17:27