You are here: Re: problem with session « PHP Language « IT news, forums, messages
Re: problem with session

Posted by Stefan Rybacki on 06/24/05 14:49

SAN CAZIANO wrote:
> 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>
>
> &nbsp;<img src=\"../italiano.bmp\" onClick=\"LanguageChange('ITA')\">
>
> </td>
>
> <td>
>
> &nbsp;<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.

The problem is that PHP is server side and javascript is client side.
Have a look at your source after the top frame is loaded.
To change the language you to reload the top frame with for example a
GET parameter to the PHP script that changes the language.

Regards
Stefan

>
> Can anyone help me as soon as possible, please.
>
>
>
>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация