My site has:
- 1 frame in top where I have some images to change the language of
the site if clicked
- 1 frame at left for the menu
- 1 frame at middle to load the page chosen in menu
in the index.php my code is
(i save in a var the name of the page displayed and the language active)
if(!isset($_SESSION['mainform']))
{
$_SESSION['mainform'] = "main.php";
}
if(!isset($_SESSION['language']))
{
$_SESSION['language'] = "ITA";
}
in the TopFrame my code is
<SCRIPT language="JavaScript">
function LanguageChange(language)
{
//i get the current viewed page
document.TopForm.main_form.value=parent.document.all.mainFrame.src;
//i change the site language
switch (language)
{
case 'ITA':
document.TopForm.selected_language.value='ITA';
<?php $_SESSION['language']='ITA'; ?>
break;
case 'ENG':
document.TopForm.selected_language.value='ENG';
<?php $_SESSION['language']= 'ENG'; ?>
break;
}
document.TopForm.submit();
}
</SCRIPT>
$TMPLAN=$_ SESSION ['language'];
echo"
<form name="TopForm">
<input name="selected_language" type="hidden" value="$TMPLAN">
<input name="main_form" type="hidden" value="main.php">
<table>
<tr>
<td>
<img src="../italiano.bmp" onClick="LanguageChange('ITA')">
</td>
<td>
<img src="../inglese.bmp" onClick="LanguageChange('ENG')">
</td>
</tr>
</table>
";
in una mia pagina che carico al FrameCentrale utilizzo queste istruzioni
(i have to read the variable of the 2 session or read the value in
document.TopForm.selected_language)
<?php
if ($_SESSION['language']=='ITA')
echo "testo italiano";
else
if ($_SESSION['language']=='ENG')
{
echo "testo inglese";
}
?>
the problem is that i can't change the language as i aspect.
Can anyone help me as soon as possible, please.