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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

passing parameters

Status
Not open for further replies.

brianjay

Programmer
Sep 14, 2000
42
US
help - passing parameters
I'm doing a search and opening a selected file on page 1 of my .asp program. The problem is

that I can't figure out how to pass the file name variable to page 2 for display on my web

page.

This is pg. 1:
<FORM ACTION=&quot;0106UploadFile.asp&quot; METHOD=&quot;post&quot; ENCTYPE=&quot;multipart/form-data&quot;>
<CENTER><BR><BR>
File: &nbsp;<input TYPE=&quot;File&quot; NAME=&quot;SelectedFile&quot;><BR><BR>
<input TYPE=&quot;Submit&quot; VALUE=&quot;Upload the File&quot;>
</CENTER>
</FORM>

and this is Pg. 2:
<%
Dim objFSO, objTextFile, selectedfile
Set objFSO = CreateObject(&quot;Scripting.FileSystemObject&quot;)

' Open the file
Set objTextFile = objFSO.OpenTextFile(Server.MapPath(&quot;selected file&quot;))

Do While Not objTextFile.AtEndOfStream
Response.Write objTextFile.ReadLine
Loop

objTextFile.Close
Set objTextFile = Nothing
Set objFSO = Nothing
%>

- Brian
 
Hi,

There are a few ways you can pass the paramter to the next page.

1) hidden field
2) Session
3) query String

just remember if you want to pass the parameter to the 3rd page you need to carry this information from page 2 to 3...except for session because it's store in memory until the user leaves.


1) hidden field
<input type=hidden name=field1 value=1>
(next page)
u do Request.Form(&quot;field1&quot;) will return back the variable

2) query string
whenever you submit something just put ?field1=&quot;the variable&quot; at the end.
Request.QueryString(&quot;field1&quot;) will return back the variable

3) Session
Session(&quot;field1&quot;) = blah

Just do Respose.Write(Session(&quot;field1&quot;))
will yeild back the variable.

Hope that helps,
Hui Emagine Solutions, Inc.
 
Hi,

There are a few ways you can pass the paramter to the next page.

1) hidden field
2) Session
3) query String

just remember if you want to pass the parameter to the 3rd page you need to carry this information from page 2 to 3...except for session because it's store in memory until the user leaves.


1) hidden field
<input type=hidden name=field1 value=1>
(next page)
u do Request.Form(&quot;field1&quot;) will return back the variable

2) query string
whenever you submit something just put ?field1=&quot;the variable&quot; at the end.
Request.QueryString(&quot;field1&quot;) will return back the variable

3) Session
Session(&quot;field1&quot;) = blah

Just do Respose.Write(Session(&quot;field1&quot;))
will yeild back the variable.
-----------------------------------------------------------
Then you can just do this filename = (whatever method)
filename = filename & &quot;.asp&quot;
and then do
Set objTextFile = objFSO.OpenTextFile(Server.MapPath(filename))
------------------------------------------------------------
Hope that helps,
Hui Emagine Solutions, Inc.
 
Try this:

This is pg. 1:
<FORM ACTION=&quot;0106UploadFile.asp&quot; METHOD=&quot;post&quot; ENCTYPE=&quot;multipart/form-data&quot;>
<CENTER><BR><BR>
File: <input TYPE=&quot;File&quot; NAME=&quot;SelectedFile&quot;><BR><BR>
<input TYPE=&quot;Submit&quot; VALUE=&quot;Upload the File&quot;>
</CENTER>
</FORM>

and this is Pg. 2:
<%

Dim objFSO, objTextFile, selectedfile
Set objFSO = CreateObject(&quot;Scripting.FileSystemObject&quot;)

' Open the file
-----> HERE
Set objTextFile = objFSO.OpenTextFile(Server.MapPath(Request.Form(&quot;SelectedFile&quot;)))
-----> HERE
Do While Not objTextFile.AtEndOfStream
Response.Write objTextFile.ReadLine
Loop

objTextFile.Close
Set objTextFile = Nothing
Set objFSO = Nothing
%>
Emagine Solutions, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top