Updating Database Records

Maybe someone made an error while entering info into the database. Maybe the price of your product changes. Or maybe you want to provide a way for your visitors to update their email addresses. In any case, the time will come when you have to edit your online database.

Creating Update Record Forms in Dreamweaver is similar to creating Insert Record Forms. Both require an HTML form that your audience can fill out and submit. The primary difference is that an update form is already filled out with information from the database. It’s like a combination of an Insert Record Form and a record detail page (such as the one the Master Detail Page set created, described on Master Detail Page Set).

The first step in creating an update form is to add a recordset to the update page (Creating Recordsets). The recordset retrieves the data in each field of the update form.

The recordset should contain only a single record—the one you or your visitor wants to update. Therefore, you have to filter the overall recordset using a form or URL parameter (see Filtering Information for more on filtering). For example, if you have a page that lists company employees, you could add an Edit button that links to a page containing the update form. To retrieve a specific record (the employee’s detail page), use the technique discussed on Creating a link with a URL parameter to add a URL parameter to a link. In this case, you pass the employee record’s primary key to link to the update page. ...

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.