Good friends, I am with the following prob ... Files concerned: INDEX.PHP <?php session_start(); if ($_SESSION['idioma']){ $Idioma = $_SESSION['idioma']; include("$Idioma.php"); } else { include("portugues.php"); } ?> <p><a href="mudaidioma.php?idioma=portugues"><img src="/layout/pt.png" width="16" height="11" border="0" /></a> <a href="mudaidioma.php?idioma=ingles"><img src="/layout/gb.png" width="16" height="11" border="0" /></a></p> <?php echo "$Texto1<br />"; echo "$Texto2<br />"; echo "$Texto3<br />"; ?> Code (markup): MUDAIDIOMA.PHP <?php session_start(); $Idioma = $_GET["idioma"]; $_SESSION['idioma'] = $Idioma; header("Location: index.php"); ?> Code (markup): PORTUGUES.PHP <?php $Texto1 = "Teste de texto"; $Texto2 = "Este texto é um teste"; $Texto3 = "Teste de idiomas ok!"; ?> Code (markup): INGLES.PHP <?php $Texto1 = "Text test"; $Texto2 = "This text is a test"; $Texto3 = "Language test ok!"; ?> Code (markup): --- As you can see the idea is to create a session for exchange of language ... the issue is that there is a flaw in this code, and I am not able to understand ... it is not working. Somebody help me? Thanks!!!
<?php session_start(); if ($_SESSION['idioma'] == 'ingles'){ include("ingles.php"); } else { include("portugues.php"); } ?> PHP: could work, please try. Also dont ever use include("$any_unescaped_variable_from_GET_POST_REQUEST_or_SESSION.php") - this poses a security risk.
<?php session_start(); switch($_SESSION['idioma']) { case "ingles": include("ingles.php"); break; case "whatever": include("ingles1.php"); break; case "whatever2": include("ingles2.php"); break; default: include("portugues.php"); break; } ?>