If the search page submits a single search parameter to the server, then you can build the results page without SQL queries and variables. You create a basic recordset with a filter that excludes records that dont meet the search parameter submitted by the search page.
NOTE |
|
If you have more than one search condition, you must use the advanced Recordset dialog box to define your recordset (see Searching with multiple search parameters). |
If you dont have a results page yet, create a blank dynamic page (File > New).
If the advanced dialog box appears instead, switch to the simple dialog box by clicking the Simple button.
The connection should be to a database containing data you want the user to search.
NOTE |
|
In a single-parameter search, you can search for records in only a single table. To search more than one table at a time, you must use the advanced Recordset dialog box and define a SQL query. |
You should include only the columns containing information you want to display on the results page.
Leave the Recordset dialog box open for now. Youll use it next to retrieve the parameters sent by the search page and create a recordset filter to exclude records that dont meet the parameters.
For example, if the value sent by the search page is a city name, select the column in your table that contains city names.
POST
method, or URL Parameter if it uses the GET
method.
The search page uses either a form variable or a URL parameter to pass information to the results page.
The name of the object doubles as the name of the form variable or URL parameter. You can get the name by switching to the search page, clicking the form object on the form to select it, and checking the objects name in the Property inspector.
For example, suppose you want to create a recordset that includes only adventure trips to a specific country. Assume you have a column in the table called TRIPLOCATION
. Also assume the HTML form on your search page uses the GET
method and contains a menu object called Location that displays a list of countries. Heres how your Filter section should look:
The test value simulates the value that would otherwise have been returned from the search page. Click OK to close the test recordset.
Dreamweaver inserts a server-side script on your page that, when run on the server, checks each record in the database table. If the specified field in a record meets the filtering condition, the record is included in a recordset. The script in effect builds a recordset containing only the search results.
The next step is to display the recordset on the results page. For more information, see Displaying the results.