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

Passing Parameter fro page to page

Status
Not open for further replies.

lcky

Programmer
Sep 29, 2005
30
0
0
GB
Hi

I have a ASP page which display 5 records at a time from resulted query. I am using paging record set.
I have sql query on this page. This query take two parameters from previous user search screen.
I stored this values into two variable eg X and Y and passed them to sql query.

The query is working fine and display 5 records. I have Previous and Next button on the screen.

When I click next button, I am getting error on the page, display query with empty parameter on the page.

It look like my two variable to the query is not passing from page to page.
I managed to get Button working with the query, without passing parameter.

Please could help me how to write code for passing parameter from page to page.


Many thank

 
If you want to pass two values 'A' and 'B' to another page and A has a value of 5 and B has a value of 10 you the link would look like this:

<a href="nextpage.asp?A=5&B=10">Click Here</a>

To reassign those values on your nextpage.asp:

A=Request.QueryString("A")
B=Request.QueryString("B")

Hope this helps.
 
first thing you have to change is...

you may have something like this...

<form name="myname" method="POST" action=blah.asp">

change it to the following

<form name="myname" method="GET" action=blah.asp">

second, you need to collect the form variables as suggested by emozley using request.querystring instead of request.form

third, you have to construct your prev and next links with the values of these form variables embedded...something like


-DNG
 
Just to follow up on what DNG was saying... if you wish to use a button in a form, but you would rather use POST instead of GET, then you'll need a pair of hidden form elements to carry your values X and Y.[tt]
<form name="myname" method="POST" action=blah.asp">
<input type="hidden" name="X" value="<%=X %>"
<input type="hidden" name="Y" value="<%=Y %>"
<input type="submit" value="Next">
</form>[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top