regoch Posted June 6, 2011 Share Posted June 6, 2011 Hi! I have problem with switch language code. <?=$home_jezik?> Its my variable for active language. But i won't to add it in php script to call difrent php for every language. <?php include("include/jezici.php"); //Start session session_start(); //Podaci za spajanje na bazu podataka require_once('kontakt-obrada-???.php'); $_SESSION['myForm'] = $_POST; ?> I wonnA add language variable where is "???". Try some different ways but always getting error. Link to comment https://forums.phpfreaks.com/topic/238550-language-switch/ Share on other sites More sharing options...
regoch Posted June 6, 2011 Author Share Posted June 6, 2011 <?php include("include/jezici.php"); //Start session session_start(); //Podaci za spajanje na bazu podataka require_once('kontakt-obrada".$home_jezik.".php'); $_SESSION['myForm'] = $_POST; ?> I ttry something like this but nothing. Link to comment https://forums.phpfreaks.com/topic/238550-language-switch/#findComment-1225843 Share on other sites More sharing options...
WebStyles Posted June 6, 2011 Share Posted June 6, 2011 assuming you select the language once for each session, you can use a $_SESSION variable to hold it: session_start(); $_SESSION['lang'] = 'en'; require_once('kontakt-obrada_'.$_SESSION['lang'].'.php'); will load: kontakt-obrada_en.php; hope this helps Link to comment https://forums.phpfreaks.com/topic/238550-language-switch/#findComment-1225857 Share on other sites More sharing options...
regoch Posted June 6, 2011 Author Share Posted June 6, 2011 session_start(); $_SESSION['lang'] = '$home_jezik'; require_once('kontakt-obrada_'.$_SESSION['lang'].'.php'); This way works for every language, not just for english! Thanks! Link to comment https://forums.phpfreaks.com/topic/238550-language-switch/#findComment-1225910 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.