[Solved]Php with Cookies, Help Please

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
kaYak
Forum Commoner
Posts: 65
Joined: Mon Feb 02, 2004 2:43 pm
Location: USA

[Solved]Php with Cookies, Help Please

Post by kaYak »

The homepage of my site is a page in 6 different languages that says "Welcome to our site. Please select your language." I have all of these flags for different languages to enter my site in. I am using Google to have the pages translated through frames. Well, anyway, what I want it to do is when they select their language it will set a cookie to remember their language so the next time they come to the homepage it will forward them to a different page depending on their language. Can someone please help me with this. :D

Thanks,
techguy
Last edited by kaYak on Sat Mar 13, 2004 11:27 pm, edited 1 time in total.
ckuipers
Forum Commoner
Posts: 61
Joined: Mon Mar 24, 2003 6:10 am

Post by ckuipers »

Code: Select all

setcookie ("CookieName", CookieValue, time()+1209600);
This sets the cookie. You basically do this when the language is changed.

Code: Select all

if (isset ($HTTP_COOKIE_VARSї"CookieName"]))
{
redirect to page using language
}
else stay on default page
On every page read cookie to decide what language to use

Hope this helps.
User avatar
Dr Evil
Forum Contributor
Posts: 184
Joined: Wed Jan 14, 2004 9:56 am
Location: Switzerland

Re: Php with Cookies, Help Please

Post by Dr Evil »

techguy wrote:I am using Google to have the pages translated through frames.
I work on lots of multilanguage sites and google certainly doesn't seem to me a very wise solution for translation. You give off a cheap image this way, as google is more than approximative !
Post Reply