|
Getting the search parameters from the user
The search parameters you provide users must correspond to values in columns in your database table or tables. For example, if your database table has a column of department names, then you can let users specify department names as one of their search parameters.
You get the user's search parameters with an HTML form. The user specifies the parameters' values in the HTML form then clicks the Submit button to send the parameters to the server, where another page uses them to search the database.
Here's an example of a search page that uses two search parameters:
The search parameters can be virtually anythingarea codes, months, employee names, part numbersso long as your database contains columns with similar values.
To build a page that gets search parameters from the user:
1 |
Create a new page (File > New File) or open a pre-designed search page. |
2 |
Insert an HTML form on the page (Insert > Form). |
|
UltraDev adds an empty form to the page. You may have to turn on Invisible Elements (View > Visual Aids > Invisible Elements) to see the form's boundaries, which are represented by thin red lines. |
3 |
Add text fields (Insert > Form Objects > Text Field ) or list/menu objects (Insert > Form Objects > List/Menu) to the form. |
|
The choice of form objects depends on the search parameters. If a search parameter can have more than about a dozen values, use a text field. For example, online bookstores often use a text field to let users search for a book. |
|
If a search parameter will have less than about a dozen possible values, use a list/menu. A list/menu lets the user select the search parameter from a limited list of parameters defined by you. |
4 |
Add a Submit button to the form by choosing Insert > Form Objects > Button. |
|
When clicked, the Submit button sends the search parameters to the server for processing. |
5 |
If you want, change the label of the Submit button by selecting the button, opening the Property inspector (Window > Properties), and entering a new value in the Label textbox. |
|
For example, here's the Property inspector of a button labeled "search": |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
If the results page doesn't exist yet, create a new page (File > New File) and make sure the filename matches the name you specify in the Action box of the Property inspector above. This ensures the results page is the page the server processes after the user clicks the form's Submit button. |
8 |
In the Method pop-up menu on the form's Property inspector, choose GET or POST . |
|
The GET and POST methods offer different ways to send form data to the server. If you choose the POST method, the search parameters are sent in the body of the message. If you choose the GET method, the parameters are appended to the page's URL as a query string. |
|
If you plan to use record navigation server behaviors on your results page (for example, if you plan to display multiple pages of results), choose the GET method. This ensures your results page is compatible with the search page and the record navigation server behaviors, both of which rely on URL query strings to function properly. |
9 |
Use Dreamweaver's design tools to customize the search page to your liking. |
|
|
The next step is to complete the results page. The results page, not the search page, is responsible for searching the database, retrieving the records found, and building a recordset with them. All these tasks are performed by a database query on the results page.
|
|
|
|