problem with session

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • SAN CAZIANO

    problem with session

    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($_SES SION['mainform']))

    {

    $_SESSION['mainform'] = "main.php";

    }





    if(!isset($_SES SION['language']))

    {

    $_SESSION['language'] = "ITA";

    }





    in the TopFrame my code is





    <SCRIPT language="JavaS cript">

    function LanguageChange( language)

    {

    //i get the current viewed page


    document.TopFor m.main_form.val ue=parent.docum ent.all.mainFra me.src;



    //i change the site language

    switch (language)

    {

    case 'ITA':


    document.TopFor m.selected_lang uage.value='ITA ';

    <?php $_SESSION['language']='ITA'; ?>

    break;

    case 'ENG':


    document.TopFor m.selected_lang uage.value='ENG ';

    <?php $_SESSION['language']= 'ENG'; ?>

    break;

    }

    document.TopFor m.submit();

    }

    </SCRIPT>



    $TMPLAN=$_ SESSION ['language'];

    echo"

    <form name=\"TopForm\ ">

    <input name=\"selected _language\" type=\"hidden\" value=\"$TMPLAN \">

    <input name=\"main_for m\" type=\"hidden\" value=\"main.ph p\">

    <table>

    <tr>

    <td>

    &nbsp;<img src=\"../italiano.bmp\" onClick=\"Langu ageChange('ITA' )\">

    </td>

    <td>

    &nbsp;<img src=\"../inglese.bmp\" onClick=\"Langu ageChange('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.TopFor m.selected_lang uage)

    <?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.


Working...