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

pass url parameter

Status
Not open for further replies.

aspnet98

MIS
May 19, 2005
165
US
I have a page that users submit information on.
Their are 17 weeks, so i build hyperlinks with this code.
</strong><br />
<div align="left"></div>
<div align="left"><strong>Weeks:
<% for i = 1 to NumberOfWeeks() %>
<a href="<% = Request.ServerVariables("SCRIPT_NAME") %>?week=<% = i %>">
<% = i %>
</a>&nbsp;
<% next %>
</strong></div>

when the user clicks the link the url will display

i then want to response.redirect after the submit button is clicked passing the parameter to a page called confirm.asp.

I need to have a link on the confirm that would take the user back to

or what ever week was selected.

is this possible?
 
i have to many session variables set. I need to do it the url way. Please, my admin will not allow any more session variables...:(
 
If you do a server.transfer then the request variables (POST/GET form data) will be available to the page transferred to, so you don't need to do anything else to pass them to the target page.

But check out the pro's and con's first.




A smile is worth a thousand kind words. So smile, it's easy! :)
 
Umm, you can do it without a Session variable.
I have a bit of confusion on your process though.

You have a link with the value in it. Then the user clicks the submit button and it goes to the next page, which Response.Redirect's to a third page, which then needs a link back to the first page...is it me or is there a step missing here?
Is the user clicking the link, being taken to a page with a submit button, then clicking the submit button, etc?

If thats the case then what we have is:
1st Page: links with "week" vars in Querystring
2nd Page: a form with a submission button (you could put a hidden field in this form with the value of the week variable)
3rd Page: a page that Response.Redirects...you could use the form value from the previous page and add to the querystring
4th Page: the value gets passed in in the querystring, so you can rebuild your link back.

Code:
1st Page:
<a href="<% = Request.ServerVariables("SCRIPT_NAME") %>?week=<% = i %>">

2nd Page:
<input type="hidden" name="week" value="<%=Request.QueryString("week")%>">

3rd Page:
Response.Redirect "confirm.asp?week=" & Request.Form("week")

4th Page:
<a href="<% = Request.ServerVariables("SCRIPT_NAME") %>?week=<%=Request.QueryString("week")%>">

And there it is. The missing link was probably adding the page number to the 2nd page as a hidden field. That way it gets carried along with form data and can be added to therediect and then the link.

-T

barcode_1.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top