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

Dynamic jump menu to sort recordset

Status
Not open for further replies.

credo

Programmer
Jul 26, 2001
50
0
0
GB
I am retreiving a recordset into a web page from an access db and want to build a small jump menu to allow users to sort the recordset by category (one of the columns retreived from the db).

The index_jump page runs the SQL that retreives the recordset from the db to display. Basically I want to refresh this page and pass a number/parameter to the SQL query which will relate to the ORDER BY clause of the SQL each time an selection is made.

I have a form(form1) with a jump menu in it.
<form name=&quot;form1&quot; method=&quot;post&quot; action=&quot;index_jump.asp&quot;>
<select name=&quot;menu1&quot; onChange=&quot;MM_jumpMenu'parent',this,0)&quot;>
<option value=&quot;1&quot;>label1</option>
<option value=&quot;2&quot;>label2</option>
<option value=&quot;3&quot;>label3</option>
</select>
</form>

does not refresh the page as expected - it's passing the values across in the URL - so I get a blank page but say if I pressed option 2 it will show mydomain/2

if I make the options =
<option value=&quot;index_jump&quot;>label1</option> the page does refresh. But then how do I pass values across to the SQL ?

This is the first hurdle which I'm stumbling on.
 
Once the form is submitted you can retrieve the value from the &quot;menu1&quot; select menu by simply referring to the request(&quot;menu1&quot;) value.

So:

Code:
orderby = request(&quot;menu1&quot;)
sqlcode = &quot;select * from table where whatever ORDER BY &quot; & orderby

It is that simple! There are other things to consider such as what the order should be if there is no value, but that is secondary for now. Derren
[Mediocre talent - spread really thin]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top