I have 2 asp pages, Page1.asp and Page2.asp. Page2 is a "printable"
version of Page1 and it contains the same information as Page1.
When Page1 is loaded in the browser it connects to a database and
retrieves some information which is used to do some calculations and
to display some data on this page. At the bottom of the page is a
'Print' button. When the user clicks this button it opens Page2 in a
new window and displays the same data in a format that can be printed.
Which is the best way to get the information from Page1 to Page2:
1. Using hidden fields on Page1.asp
2. Using session variables
3. Connecting to the database on Page2 and retrieving the information
again.
I'm considering option 1, creating form with hidden fields on Page1
that will contain the values that are required on Page2 and posting
that form to Page2.
Page2 will contian code such as:
dim Temp1, Temp2
Temp1 = Request.Form("Field1Name")
Temp2 = Request.Form("Field2Name")
for each of the fields on Page1. The data will be displayed on this
print-friendly page using code similar to:
Field One: <%=Temp1%>
Field Two: <%=Temp2%>
Is this the right approach, or would I be better off using one of the
other approaches (session varibles or retrieving the data from the
datbase again)?