When building a website where your users need to update information in a database, you may want to allow them to update multiple entries at once. This tutorial will demonstrate how to create a Web page that updates multiple records and stores them in a database.
1. In the Files panel, open the sample file: sample_form_update.php.
2. In the Server Behaviors panel, select +.
3. Choose Recordset.
4. Enter rsCat in the Name field.
5. Select your Connection.
6. Select itemcategory from the Table list.
7. Click OK and save the page (Ctrl or Cmd + S).
1. Place your cursor in the form field.
2. In the property inspector panel, click the lightning bolt.
3. In the Dynamic Data window, choose ItemCatName and click OK.
4. Now the initial value of your form field has been bound to your recordset.
1. Each of your form elements should have unique names. This example has only one text field: Name.
2. In design view, select the form field and the label, then click the <p> tag in the Tag Selector.
3. In code view, this portion of the code should now be highlighted.
4. From the Server Behaviors panel, click + and choose Repeat Region.
5. In the Repeat Regions dialog box, make sure your recordset is displayed and set Show to All records. This setting allows you to update all of your records at once.
6. Click OK. You’ll notice Dreamweaver has surrounded your selection with a Repeat Region tab and border.
1. From the Server Behaviors panel, click + and choose WebAssist > DataAssist > Update > Multiple Record Updates.
2. When the Update Multiple Records wizard opens, you’ll first select the event to execute the server behavior from the Trigger list. Select Button: submit pressed.
3. In the Repeated form list, select Repeat Region (rsCat).
4. In the Database section, choose your database connection from the Connection list. Then choose the database table you want to update the records into from the Table list, itemcategory. There is nothing to change in the Key Column since ItemCatID is the default setting.
5. If you’d like to display a particular page after the update operation is complete, browse for the file by clicking the folder icon next to the Go to (optional) field. In my example, I chose the results page so I can see the records that have been updated.
6. Next, click on the Bindings tab to bind the database columns to the form fields.
7. Select each database column in the Column list and if necessary, modify the Data Type. Click the lightning bolt next to the Value list to choose the proper form element.
8. Select the form field (Name) and click OK.
9. When you’re done, click Finish.
10. Save your page (Ctrl or Cmd + S) and preview (F12) to to try out the page on your Testing server.
Now your application is ready to update multiple records in a single page.
DataAssist also allows you to create a multiple record insert form and a multiple record delete form. View the tutorials at Create a multiple record insert form and Create a multiple record delete form.
Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.
These out-of-the-box solutions provide you proven, tested applications that can be up and running now. Build a store, a gallery, or a web-based email solution.