Forums
This topic is locked
If, Then, Else statement
Posted 05 Jun 2002 19:54:44
1
has voted
05 Jun 2002 19:54:44 Mitchel Tendler posted:
I have the following code on a page:<%
if Session("lang"

response.redirect("sv.html"

else
if Session("lang"

response.redirect("sv-fi.html"

else
if Session("lang"

response.redirect("en-gb.html"

else
if Session("lang"

response.redirect("en-us.html"

else
response.redirect("nodetect.html"

end if
end if
end if
end if
%>
The code works fine, except if there are 2 languages set in the browser.
I noticed that if I have 2 languages set on my browser, like "en-us" and "en-gb" that the "Session("lang"

Is there a way to replace the "=" in the statment with something that would be more like a "contains" or "like" statement? LIKE does not work <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
Thanks!
Mitch
When in doubt...reboot!
Replies
Replied 05 Jun 2002 21:49:18
05 Jun 2002 21:49:18 Owen Eastwick replied:
Try:
<%
varLang = Session("lang"
If varLang = "sv" Then
response.redirect("sv.html"
ElseIf varLang = "sv-fi" Then
response.redirect("sv-fi.html"
ElseIf InStr(varLang, "en-gb"
<> 0 Then
response.redirect("en-gb.html"
ElseIf InStr(varLang, "en-us"
<> 0 Then
response.redirect("en-us.html"
Else
response.redirect("nodetect.html"
End If
%>
Regards
Owen.
Multiple Parameter UD4 / Access 2000 Database Search Tutorial:
www.tdsf.co.uk/tdsfdemo
<%
varLang = Session("lang"

If varLang = "sv" Then
response.redirect("sv.html"

ElseIf varLang = "sv-fi" Then
response.redirect("sv-fi.html"

ElseIf InStr(varLang, "en-gb"

response.redirect("en-gb.html"

ElseIf InStr(varLang, "en-us"

response.redirect("en-us.html"

Else
response.redirect("nodetect.html"

End If
%>
Regards
Owen.
Multiple Parameter UD4 / Access 2000 Database Search Tutorial:
www.tdsf.co.uk/tdsfdemo
Replied 05 Jun 2002 21:56:21
05 Jun 2002 21:56:21 Mitchel Tendler replied:
Thanks Owen...I'll give it a shot!
Mitch
When in doubt...reboot!
Mitch
When in doubt...reboot!