Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multi Pages and Parameters.....Please Help

Status
Not open for further replies.

randusoleis

IS-IT--Management
May 11, 2001
43
0
0
US
I am creating a site that has multiple pages. Searches, Results, Update, Insert...the whole nine yards you could say. Here is my question->
I have a results page I want to give the users options on. For example, my tables are set up in a way that 1 table has Children and another has Parents. We all know (some too well) that parents can have many children. So I have created a button that will allow users to add children. I pass a form parameter (GET METHOD) using the request variable in data bindings to populate the familyID for the insert page (this way the kids don't get lost in the database). But Wait!. I have other insert pages that also require the same variable. How can I keep this variable active thru many pages? Randusoleis.....
 
Hi

If you want to keep moving a piece of information around such as your family ID there are a number of different ways. If it is part of your URL string you can write it into your code for that page wherever you like. This requires three things; that your web server can deal with ASP, that
Code:
<%@LANGUAGE=VBSCRIPT%>
is written at the very top of your page (before HTML), and that anywhere you wish to add the url parameter you just write

Code:
<%=Request(&quot;familyID&quot;)%>

if that is the name of the field you used.

OK, so you have used it on the first page, now what? Well, you can add extra text to the end of all your links and form actions such as
Code:
&quot;url.asp?familyID=<%=request(&quot;familyID&quot;)%>&quot;
. That way every page that they go to next the value is passed around. This requires a reasonable amount of work to ensure that the URL parameter is not lost and the value can easily be changed by someone else.

The easy and effective way (though we will no doubt get some feedback about it) is to use a session variable. What?
This is a variable that lasts as long as the browser is on the site. You can set it, read it and change it all you like. For example:

Code:
<%
Session(&quot;familyID&quot;)=request(&quot;familyID&quot;)
%>

will create a new session variable called familyID with the value that matches your value from the form. You can also set the value to something else when you like:

Code:
<%
Session(&quot;familyID&quot;)=newvalue
%>

and if you wish you can write its value wherever you like (into a hidden field for example)

Code:
<input type=&quot;hidden&quot; value=&quot;<%=Session(&quot;familyID&quot;)%>&quot;>

See what you think.
Derren
[The only person in the world to like Word]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top