Ver Mensaje Individual
  #5 (permalink)  
Antiguo 10/11/2015, 06:11
Avatar de agusax
agusax
 
Fecha de Ingreso: junio-2011
Ubicación: Puerto Real (Cádiz)
Mensajes: 74
Antigüedad: 12 años, 10 meses
Puntos: 3
Respuesta: Variable SESSION por enlace

Lo he solucionado de otro modo:
Index.php
Código PHP:
Ver original
  1. <?php
  2.     // Para que no se muestre warning
  3.     error_reporting(E_ERROR | E_PARSE);
  4.  
  5.     session_start();
  6.  
  7.     $_SERVER['REQUEST_URI'];
  8.  
  9.     if($_SESSION['lang']=='en'){
  10.         include('lang/en_index.php');
  11.         include('lang/en_menu.php');
  12.     }else{
  13.         include('lang/es_index.php');
  14.         include('lang/es_menu.php');
  15.     }
  16. ?>

lang.php
Código PHP:
Ver original
  1. <?php
  2.     session_start();
  3.     $idioma = $_GET['lang'];
  4.     $_SESSION['lang']=$idioma;
  5.     header('Location:' . getenv('HTTP_REFERER'));
  6. ?>

Y de este modo cuando hago click a una bandera de idioma de la siguiente manera ya me funciona correctamente:
Código HTML:
Ver original
  1. <li><a href="lang.php?lang=es"> <img src ="images/es.png" height="20px"></a></li>
  2. <li><a href="lang.php?lang=en"> <img src ="images/en.png" height="20px"></a></li>