Hi,
I have just started out crafting my own web page by modifying an existing design.
One part of my modification is to break up the existing static html code into php chunks where the header of my page is one part.
In the header part I have the following construction for language selection
<li><a href="language.php?lang=en" title="English"><img src="./img/flag_uk.gif" alt="Image description" /></a></li>
And the functionality is that the user should click on one of the maps to switch language. (it is actually one row for each supported language)
For this purpose did I make a simple function as
function set_language($lang_sel)
{
global $_lg;
global $lg_en;
global $lg_se;
global $lg_ge;
global $lg_es;
switch($lang_sel)
{
case "en":
$_lg = $lg_en;
break;
case "se":
$_lg = $lg_se;
break;
case "de":
$_lg = $lg_de;
break;
case "es":
$_lg = $lg_es;
break;
}
}
My problem as a newbie to web design and coding in php is that I dont know where to put the function and how to call it with the selected language argument. This header is used on all pages and the language selection should not move the user to a new page.
I have found the following construction
header("Location: ".$session->referrer."");
Which I guess could be used in language.php (from the above html snippet) to get the user back to the same page as when clicking on one of the flags.
If I am not making myself clear please advise me on what more information you want from me.
The global language variables are declared in a separate php file included on every page and all content pages are referring to the $_lg variable.
Thanx for reading.