VaulX Posted July 2, 2010 Share Posted July 2, 2010 Hello, I'm new to PHP and have limited knowledge other than echoing, setting/defining constants and simple mathematics. I am developing a simple website that is to use the English and Vietnamese languages. Don't worry, my wife is doing all the Vietnamese translating. On another website I developed I used two images of flags as the language buttons at the top of the screen. This simply redirected you to either an EN or VN directory of the website. The problem is the website had to be created twice in these two directories. This time I have defined to PHP language files. Each file has the same variables/constants defined using "define" but with different values, either English or Vietnamese. All the web pages echo the corresponding constant to display the text/value. Each web page uses the "include" command at the top of the web page. What I want are push buttons at the top of the screen that defines what a language variable for each web page to use. The push buttons are simple English or Vietnamese flags that I use CSS to create. I feel I'm so close, but I just can't figure out how to reassign a variable and cause the screen to refresh with the new language. Any help will be greatly appreciated. Thanks Link to comment https://forums.phpfreaks.com/topic/206534-html-image-button-to-assign-php-variable/ Share on other sites More sharing options...
AbraCadaver Posted July 2, 2010 Share Posted July 2, 2010 Your link can have something like ?lang=EN and then you can get it with $_GET['lang'] and use it how you wish. Link to comment https://forums.phpfreaks.com/topic/206534-html-image-button-to-assign-php-variable/#findComment-1080370 Share on other sites More sharing options...
VaulX Posted July 3, 2010 Author Share Posted July 3, 2010 Thanks, Abra... I noticed this method of passing information via URL addresses, but just not sure how I would proceed. At the beginning of every web page it would call a language.php file to determine which language to use. It would determine the correct language by what the global, constant variable is set to. I might have my terminology wrong so please feel free to correct me. I suppose it doesn't need to refresh the current screen but redirect them to the home page displaying the new language. Somehow the image buttons need to pass the language information to the home page via the URL trick you mentioned. Can the home page look for the value and use it if it's there? Link to comment https://forums.phpfreaks.com/topic/206534-html-image-button-to-assign-php-variable/#findComment-1080570 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.