Building a Data Update Form

Populating an HTML form is a simple process. First, you must retrieve the row to be updated from the table. You do this with a standard <cfquery>; the retrieved values are then passed as attributes to the HTML form.

Listing 14.9 contains the code for update1.cfm, a template that updates a movie. Save it as update1.cfm, and then execute it. Be sure to append the FilmID—for example, ?FilmID=13—as a URL parameter. Your screen should look like Figure 14.4.

Listing 14.9. update1.cfm—Movie Update Form
<!--- Name: update1.cfm Author: Ben Forta (ben@forta.com) Description: Table row update demo Created: 07/01/07 ---> <!--- Check that FilmID was provided ---> <cfif NOT IsDefined("URL.FilmID")> <h1>You did not specify the FilmID</h1> ...

Get Adobe ColdFusion 8 Web Application Construction Kit, Volume 1: Getting Started now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.