Jump to content

HTML Image Button to Assign PHP Variable...


VaulX

Recommended Posts

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.