All the SELECT queries you have seen so far are static queries; that is, you're issuing the same SQL statement time after time. Static SELECT queries have their place, but it can be more interesting to create SELECT queries in which some part of the query is determined by the user by means of HTML form submission. The examples in this section show you how to build interfaces that enable users to query your database tables and see the records that are returned by those queries.
One way to let users search your database is to present them with a listing that summarizes the records you have and to allow them to choose a record to review in more detail. Listing 4.4 showed how to generate a drop-down list of customer names. When you pick a customer from this list and click the submit button, the processing script called showcustomerdetail.cfm retrieves the chosen customer's record and shows you the contents. Listing 4.5 illustrates how to display the customer's detail record, and Figure 4.5 shows the resulting detail page.