11. Creating Search and Results Pages
Search and results pages work together to query a database, depending on the information a user requests. The search page contains an HTML form with at least one form object, such as a menu or text box, and a submit button, which sends the user's request to the results page. The results page dynamically creates a recordset based on the request and displays the results.
Building search and results pages requires that you combine several skills you learned in previous chapters in a new way. To create a search page, you need to insert an HTML form, at least one form object, and a submit button. To create a results page, you need to create a recordset and recordset filter, insert a dynamic table, and add Show/Hide server behaviors.
In this chapter, you'll learn how to build two types of search and result pages: pages for a single search parameter and pages for multiple search parameters. You'll also learn how to display the results of the search in a dynamic table, and how to add two behaviors from the Show Region server behavior group (Show If Recordset Is Empty and Show If Recordset Is Not Empty). These behaviors let you show or hide different parts of the results page, based on whether a recordset is empty or not empty. For example, you can display a message to let users know there are no results from their search request.
The process of creating search and results pages is the same whether you're using ASP, PHP, or ColdFusion. We're using ASP, PHP, and ColdFusion for the exercises in this chapter because the code is similar and none requires object-oriented programming languages. The process is also the same for JSP but differs for ASP.NET. See Dreamweaver Help (F1) for more details on creating search and results pages using ASP.NET.