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

DESPERATE!! Drop down list from database to a form

Status
Not open for further replies.

GROOVYHEN

Programmer
Apr 19, 2004
12
GB
I have an Access database of albums, and I want to fill a drop down list with field (I think that's the right term) information, and then when the user picks a selection, they are sent to another asp page, via a FORM, where various fields from that choice are shown.

e.g.

1st page:
__________
| |
-|album 1 |
-|album 2 |
-|album 3 |
-|album 4 |
-----------

|submit|

2nd page:

Album Name (*) | Price |
info info

(*) Album name would be the one they picked on page 1.


Likewise, if I wanted a drop down list that would display all genres of album (jazz, electronica, trip hop), so that various albums would be displayed on the 2nd page, how could I do that?

PLEASE REPLY SOON, as although I can create a drop down list that doesn't do anything, I really need to be able make one that sens results from a form to a table on another page.
 
<SELECT NAME="ABC">
'Now open the database connection and recordset
'Then check
if rs.BOF then
%>
<OPTION>------></OPTION>
<%
else
while not rs.EOF
%>
<OPTION><%= rs.Fields("XYZ") %> </OPTION>
<%
rs.MoveNext
wend
end if
%>
</SELECT>
 
But how does this link to a table that displays this info on another page????
 
You have to do a SELECT query.

For example:

SELECT Name,Info, Price from ALBUM WHERE Name='"&request("albumname")&" '

and then display a table in the page to list the results.

Hope that helps

VJ
 
Say I had an Access table that looked something like:

Album Title | Artist | Genre
----------------------------
album1 | AA | jazz
album2 | BT | jazz
album3 | CC | pop
album4 | DF | rock
album5 | LL | rock

I want the genre field (is field the correct term?) to be displayed in a picklist on page 1. Then the user would pick it, press submit, and on page 2, a table would appear displaying all the albums and artists of that particular genre. How could I do that?
 
Take Vikrams 1st code example of building the select and usethat in your form on the first page. This will allow your user to pick an album and submit it to the next page.

On the next page use Vikrams explanation of selecting by the submitted albumname to pull back the details for that album.

-T

01000111 01101111 01110100 00100000 01000011 01101111 01100110 01100110 01100101 01100101 00111111
The never-completed website:
 
Oops, replace all occurences of album in my previous post and change those to Genre, cange the final "details for that album" to "list of albums for that genre
 
i typically add a second argument to it for a default value and check for it and add "SELECTED" to the drop down, just in case you want default values.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top