Hi Guys,
I am new to this forum and PHP. I have to appoligize for my English and my questions.
I am trying to develop a multi language application where I retrieve the labes from the database. My pages are working fine but the behaviour of PHP is driving me crazy.
<?php
session_start();
login();
function login() {
if ($POST['abgeschickt_test']) {
if ($POST['Submit'] == 'Login') {
print "Login with Language: ".$SESSION['lang'];
}
if ($POST['lang'] == 'Deutsch') {
$SESSION['lang'] = 'DEU';
}
if ($POST['lang'] == 'English') {
$SESSION['lang'] = 'ENG';
}
if ($POST['lang'] == 'Fraincaise') {
$SESSION['lang'] = 'FRA';
}
if ($POST['lang'] == 'Italiano') {
$SESSION['lang'] = 'ITA';
}
show_form('', $SESSION['lang']);
}
else {
$SESSION['lang'] = 'DEU';
show_form('', $_SESSION['lang']);
}
}
// function show_form is working fine
// The problem is that it should show
// Login with Language: ITA, ENG, DEU, FRA but $_SESSION['lang'] is either empty // or a default value
// if I change the language before login on I will have 3 cookies
// Cookie #1 = lang|s:3:"DEU"; This is the default path
// Cookie #2 = lang|s:3:"FRA"; After changing the language
// Cookie #3 = After clicking "Login"
?>
It looks like the programm starts new every time I do anything on the page.
I really hope that somebody can help me.
Cheers
Uwe