Passing vairable values from page to page with VBScript 
Author Message
 Passing vairable values from page to page with VBScript

Hello all.

I'm relatively new to VBScript and to ASP, and have a question that I hope
someone out there can answer.  I've got a form that users input data into
and I have an asp page that uses the Request.querystring function to read
those values and post them to a database.  However, I would like to use
those same values in another page that users will be directed to using the
Response.redirect function.  Is there a way to pass those variable values
collected to subsequent pages?

Any assistance would be appreciated.

Craig



Tue, 02 Jul 2002 03:00:00 GMT  
 Passing vairable values from page to page with VBScript
If the url is

page1.asp?P1=a&P2=b

then on page 1 you can

<%
    response.redirect "Page2.asp?P1=" &
server.urlencode(Request.QueryString("P1")) & "&P1=" &
server.urlencode(Request.QueryString("P1"))
%>

Or I think this might work if you want to send the whole lot

Response.Redirect "Page2.asp?" & Request.QueryString



Tue, 02 Jul 2002 03:00:00 GMT  
 Passing vairable values from page to page with VBScript

Here's a general suggestion for anyone using either POST or GET in the form method.  You're using GET since you said you retrieve via Request.QueryString.

If the form method is POST, then in the receiving ASP page, Request.Form (or Request.Form() or Request.Form.Item(), all of which are perfectly legal) will give you all of the posted name/value pairs still encoded as one big string.  On the redirect, you could simply append this to the url you are redirecting to.

...Redirect "thenext.asp" & "?" & Request.Form

If the form action is GET, the just pass on Request.QueryString

...Redirect "thenext.asp" & "?" & Request.QueryString

In the "thenext.asp", access it via Request.QueryString in both cases.   The limits for POST and GET are different (GET has a limit of somewhere around 2K I think whereas POST does not).  But if you aren't POSTing a large amount of data (or are using GET) then this might work for what you need.

--
Michael Harris

  Hello all.

  I'm relatively new to VBScript and to ASP, and have a question that I hope
  someone out there can answer.  I've got a form that users input data into
  and I have an asp page that uses the Request.querystring function to read
  those values and post them to a database.  However, I would like to use
  those same values in another page that users will be directed to using the
  Response.redirect function.  Is there a way to pass those variable values
  collected to subsequent pages?

  Any assistance would be appreciated.

  Craig



Tue, 02 Jul 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. passing a form field value from a page to a frame's page

2. Dmitry Svetlanov Passing a value to a textbox on another page

3. Passing a value to a textbox on another page

4. can i pass a check box value from one page to another

5. Pass values across pages

6. Passing Values to asp page

7. passing hidden values between pages

8. passing values to the following pages using Response.Redirect

9. Passing values between pages using a form

10. Passing values through pages

11. Pass values from FORM fields to another page without a SUBMIT action

12. Passing values between an ASP page and an HTA - VBS script

 

 
Powered by phpBB® Forum Software