Passing values from the address bar is pretty easy and makes page redirection great on single-page layouts.
Below I've pasted the coding for a menu system I have on one of our pages.
To being, you need to actually put the variable in your link. For the examples below. When I want to go to the Forum, I would put the link as "default.asp?fourm". Same for the rest of the examples. This page uses the query strings to dynamically create pages. I have a single 'default.asp' page with the layout, and the content is separated out into separate, smaller files; allowing for portability amongst our Inter and Intranets.
See the explainations below for what the coding does.
<!--Begin ASP menu system -->
<% Dim q
q = Request.querystring
Select Case q
%>
Above is what pulls the address bar information. You create your variable, pull the querystring (ASP function) into the variable, and then begin a Select Case to handle your variables and redirections.
<% Case "home" %>
<!-- #include file="inc/frontpage.htm" -->
ASP is great that it is so close to Visual Basic. Above is a standard Basic Select Case statement. If querystring, or q, equals 'home', then do an include for the file, or whatever action you are needing to do (e.g. redirection, manulipulating the variable from a form, so on.)
<% Case "forum" %>
<% response.Redirect("forum/default.asp" %>
<% Case "event_calendar" %>
<!-- #include file="inc/e_cal.htm" -->
<% Case "sts_chat" %>
<!-- #include file="inc/csc_chat.htm" -->
<% Case "submit_wo" %>
<!-- #include file="inc/submit_wo.asp" -->
<% Case Else %>
<!-- #include file="inc/frontpage.htm" -->
<% End Select %>
<!--End ASP menu system --> As above, you end your Select Case statement.
The following link from Microsoft provides great information on using multiple query strings.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.