![]() |
|
|
By Brian B.
As a newbie to ASP I often look to 4guysfromrolla.com for answers. This time was no different however I could not find a good example that would work in my situation. After a viewing a few articles and putting my head to good use I came up with the following solution. I hope it helps to keep your sites easier to maintain. Table Definition
authors note: I added the last one, just for my boss 8-) VBScript:Connect to database.... (see other articles on this site if you need help: I recommend you start with the Database F.A.Q.)
Open a Recordset and get the information to use in the drop-down list
Ok now the recordset
The next line will look through the recordset until it reaches the
The next few lines are pretty easy to follow except maybe the first.
And I only added this after my boss told me he wanted NORMAL to
be the default for this particular drop-down list. The first line says if the
All of the above ASP code would go at the top of the file within the ASP tags <% %>. And below is the HTML code to make it show the menu items. < html><head><title>Dynamic Drop-Down Menu Example</title></head><body> <form method="POST" action="dropdown_ex.asp"> <p><select size="1" name="dropdown_menu"> <%=prioritytypes%> </select></p> </form> </body> </html> A working .asp file, the Access database is included Happy Programming!
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
![]() |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||