<?php
session_start();
//conexion a la BD
include("includes/conect.php");

$id_rel_area = $_POST['id_rel_area'];

echo '<option value=""> - Seleccione - </option>';

$result_areas = mysqli_query($conexion, 'SELECT id as id_del_area, nombre, capacidad, observacion, ocupacion FROM area where estado_area = 1 and  id_rel_area = \''.$id_rel_area.'\' order by observacion asc, id asc');


  /* $result   =   mysqli_query($conexion, 'SELECT * FROM usuario WHERE usuario =\''.$k_usuario.'\'');
      $row   =   mysqli_fetch_array($result);*/



while($row_areas = mysqli_fetch_array($result_areas)){
    switch($_SESSION['k_ocupacion']){
        case 1:
            if($row_areas['ocupacion'] == 1 || $row_areas['ocupacion'] == 0){
                echo "<option value='".$row_areas['id_del_area']."'>".$row_areas['nombre']."</option>";
            }
            break;
        case 2:
            
            if($row_areas['ocupacion'] == 2 || $row_areas['ocupacion'] == 0){
                echo "<option value='".$row_areas['id_del_area']."'>".$row_areas['nombre']."</option>";
            }
            
            break;
        default:
            echo "<option value='".$row_areas['id_del_area']."'>".$row_areas['nombre']."</option>";
            break;
    }

//   echo "<option value='".$row_areas['id_del_area']."'>".$row_areas['nombre']." >> ". $_SESSION['k_ocupacion']." >> ".$row_areas['ocupacion']."</option>";

}
 
  
// Liberar resultados
mysqli_free_result($result_areas);

// Cerrar la conexión
mysqli_close($conexion);
?>