|
it
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Newbie, Language choise in cookie
I'm using this form to send a language choice to my index2 file. But I like also to save the users choice to a cookie, so I can use the language settings in all my other files. How can I do this ? <form name="Lang_choise" action="index2.asp" method="get"> <input type="hidden" name="item" value="start"> <input type="hidden" name="subitem" value="x"> <select name="lang"> <option value="Fr"> Français</option> <option value="Nl" selected> Nederlands</option> </select> <br><br> <center> <input type="submit" value="Start"> </center> </form> Thx in advance. TNG wrote on 06 mrt 2005 in microsoft.public.inetserver.asp.general:
Show quote > Hi [Please do not put irrelevant parts, like <center> in an example]> > I'm using this form to send a language choice to my index2 file. > But I like also to save the users choice to a cookie, so I can use the > language settings > in all my other files. > > How can I do this ? > > <form name="Lang_choise" action="index2.asp" method="get"> > <input type="hidden" name="item" value="start"> > <input type="hidden" name="subitem" value="x"> > <select name="lang"> > <option value="Fr"> Français</option> > <option value="Nl" selected> Nederlands</option> > </select> > <br><br> > <center> > <input type="submit" value="Start"> > </center> > </form> If it is only for the duration of the session, put the choice in a session variable. We are talking about asp, I hope? my preferred method is post, btw. index.asp: <form name="Lang_choise" action="index2.asp" method="post"> <select name="lang"> <option value="Fr"> Français</option> <option value="Nl" selected> Nederlands</option> <option value="En"> English</option> </select> <br> <input type="submit" value="Start"> </form> ======================== index2.asp: <% session("Lang_choise")=request.form("Lang_choise") %> blahbla ============================ And on most other asp pages, something like this: <% function s(Tfr,Tnl,Ten) if session("Lang_choise")="Fr" then s = Tfr elseif session("Lang_choise")="En" then s = Ten else ' "Nl" dus, s = Tnl end if end function %> <html>... <% =s("Bonjour","Goede morgen","Hi there")%> TNG,<br> <% =s("Voici mon example","Dit is mijn voorbeeld","Whatsay?")%> -- Evertjan. The Netherlands. (Replace all crosses with dots in my emailaddress) And here's a good cookie resource:
ASP Cookies http://www.w3schools.com/asp/asp_cookies.asp Best regards, J. Paul Schmidt, Freelance ASP Web Developer http://www.Bullschmidt.com ASP Design Tips, ASP Web Database Demo, Free ASP Bar Chart Tool... *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
|||||||||||||||||||||||