Dynamic Drop Down...

Populate drop down boxes from your database based on your selections. Hide items until they are ready to be displayed...

This example is using all ASP code. The only thing we did with FrontPage is create a database connection. FrontPage then created the global.asa file and the connection string. So we called that string for our connection.

There are a couple of things of note going on:
1. At first you see only one drop down box which is populated from the database. We are using the Northwind database and the supplier table. The second drop down will not show until you make a selection from the first and the results won't show until you make a selection from the second.


 

Choose a Country

 
 

 

2. Notice that the drop downs maintain the selections you made. This was accomplished simply by calling the request.form method and setting this as the default value for the form field. You could get a little more elaborate with this if you wanted to use an IF THEN statement.

3. Finally, the results have a filter on them as well. Some of the records in the database do not have Fax numbers. If that field is blank, we don't display it. This would become more apparently useful if some of the records did not contain a Phone number for example. Then the space that would be taken up by that line is eliminated. Anyone who has done something similar to this in FrontPage will understand that displaying a space for a non existent record can be ugly.

Get the code here: CODE >>

 

This site was built and is maintained by jd Web Works.
© 2006. All rights reserved.
Microsoft and FrontPage2000 are registered trade marks of Microsoft Corporation.