Tutorial: Inserting and Updating Data

In this tutorial, you’ll continue working on CosmoFarmer’s online store. You’ll work on two administrative pages that let CosmoFarmer employees add new products to the database and edit products already there.

This tutorial assumes you completed the tutorials in Chapters Chapter 23 and Chapter 24. If not, turn to Setting Up Dreamweaver, follow the instructions for preparing the application server, database, and Dreamweaver for this project. Then turn to Tutorial: Displaying Database Info and build the product catalog pages.

Adding an Insert Product Page

Start by opening a page you already created:

  1. Open the file named add.php in the admin folder of the local site you defined in Chapter 23.

    This page contains three Spry tabbed panels like the ones you learned about on Tabbed Panels. Instead of having several web pages, each dedicated to inserting one record into one database table, you can collect all the insert forms on a single page. Clicking a tab opens the tabbed panel with the appropriate insert form.

    You’ll also notice that the CosmoFarmer web designer stored this page inside a folder named admin. You don’t want site visitors to be able to see the pages that add and edit the store’s products; you wouldn’t want just anyone adding products—“The Electric Whoopee Cushion, by Mr. Hacker,” for example—to the store. Accordingly, keep these pages in a folder reserved for site administrators. (In the next chapter, you’ll learn how to password-protect these ...

Get Dreamweaver CS5: The Missing Manual now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.