Results Page Continued

Setting up the site-->
Setting up the search page-->
Setting up the results page-->
Results page continued-->
Details page and dynamic images-->
Wrapping it up-->

Now select just the table row where your bindings occur. You can verify that it is selected by checking that the tr tag is highlighted in the tag selector at the bottom of the Dreamweaver document window. Choose the Server Behavior tab in the palettes. Select the plus sign and drag to the Repeat Region behavior. The default values are fine. Say OK, and now the results will include every cat that fits the search criteria. If you had a large database with 46 Siamese cats, 10 cats would appear on the first page. There is a navigation object in Dreamweaver MX that will allow you to create next, first, last, and previous links to page through multiple pages of results. We will keep it simple for now, however.

Repeat Region Behavior

After all of this programming, we will finally get to check out some of the results. Make sure you upload the index.html page and the results.php page to your WebServer. Double click the index.html page on the Server to open it, and then preview it in a browser. Choose a breed and click the Search button. If all went according to plan, you should get a page of results for the breed of your choice.

Browser preview of the results page

You see that the picture includes a link. Once we have a set of results, we may see a cat that particularly interests us. If we click on the name of that cat, we will go to a detail page with more information about that cat. Let’s set that up now.

Select the text for the dynamic name field (rsResults.name.) In the Properties Inspector, navigate for the details.php page. The link field now says details.php, and the name placeholder displays as a link. We need to add a URL parameter for this link, however. We need to pass the unique ID of each cat in the URL so that the correct cat shows up when we click the link. After details.php you need to type the following text:

?petID=<?php echo $row_rsResults['ID']; ?>

Let’s dissect what this means. The question mark tells us there is a URL parameter we want to pass as we surf to the next page. We are giving this URL parameter a name of petID. You can call it anything you like (within proper naming conventions.) After the equals sign, we are giving the parameter a value. The ID within square brackets is what we named the auto-generated ID for each cat in our database. The $row ensures that for each requested row of the table the right cat is properly identified. The recordset we are pulling this from is the one we named rsResults. The complete URL is as follows:

details.php? petID=<?php echo $row_rsResults['ID']; ?>

Passing a URL Parameter

The Details Page-->