Jump to content


This topic is now archived and is closed to further replies.


Help with arrays please

Recommended Posts

I have been struggling with this problem for over a week and am not much nearer a solution. I am trying to create a multi language site that only requires the content to be added as simple text or html files although php files can be included. I have a page that detects the language used on the users browser; index.php:
class object {};
$config = new object;
$config->dir    = "/home/path/public_html/language2/lang_sets/";
if (! isset($lang)) {
$lang = "pt";
$lang = "en";
$lang = "lv";
else if ($lang == "pt-br" ) { $SESSION["lang"] = "pt"; }
else if ($lang == "en" ) { $SESSION["lang"] = "en"; }
else if ($lang == "lv" ) { $SESSION["lang"] = "lv"; }
else { $SESSION["lang"] = "en"; }
$config->global = $config->dir.$lang."/language.php";
include ($config->global);
<title>webwhiz language2</title></head>

The page; language_sets/en/language.php, then includes the appropriate language specific content for my language files.[code]<?
$content1 = include_once("../include/langselect.php");
$content2 = include_once("../include/contactform.php");
$content4 = include_once("../include/footer.php");
I then want the option to allow the visitor to select a different language to the one detected. For this I am trying to use this snippet I found. The included file above langselect.php contains the following code:

$language = $_GET["language"];


<select onchange="window.location='select.php?language='+this.value">


$language = array(






for ($i = 1; $i <= 4; $i++)


print "<option value=$i>$language[$i]</option>";

print "<h3>Language is : $language[$i]</h3>";




This provides a dropdown box to select a language. I am new to php and can't quite see how to make the above script redirect the user to a language specific page; in this case www.site.co.uk/language/index_en.php if English is selected from the dropdown.
Any help would be gratefully received!


Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.