close ad
 
Important WebAssist Announcement
open ad
View Menu

Web development tutorial

Create a multiple record update form

Tutorial created by Ray Borduin, WebAssist

Categories: Data Bridge, Dreamweaver, PHP

rating

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.

arrow downWhat do you need to start?

  1. Dreamweaver CS3 or newer
  2. Data Bridge (alternately, DataAssist 2.0 or higher) installed and activated in Dreamweaver
  1. Create and define a dynamic site in Dreamweaver. If you need assistance creating your site, view these tutorials: Define a dynamic site in CS4 or Define a dynamic site in CS5+.
  2. Put this sample file in the root of your site: sample_form_update.php. This will be the form we work with in this tutorial. Once you understand the concept, you can apply the steps to your own web pages.
  3. Import our sample Blue Sky Music database to use with this tutorial: blue_sky_music.sql. If you need assistance importing a SQL file, view this tutorial: Import a .sql file.
  4. Create a database connection in Dreamweaver to the Blue Sky Music database you imported. If you need assistance creating a database connection, view this tutorial: Create a PHP database connection.

arrow downCreate a recordset

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).

arrow downBind form elements to the recordsets

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.

arrow downSet up the form

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.

arrow downApply the update multiple records server behavior

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.

arrow downReviews and comments

Comments will be sent to the author of this tutorial and may not be answered immediately. For general help from WebAssist, please visit technical support.

Sign in to add comments
rating

dee: 10 Years, 10 Months, 2 Weeks, 3 Days, 3 Hours, 4 Minutes ago

Hi this looks like something I need, but being a beginner and unsure of the chargon etcc, would it be possible for you to show or explain the advantages this tutorial would be to me in layman terms.

I would so very much appreciate you doing this.
THank you for all you do, I love Web Assist.
Deeanna

rating

Team WebAssist: 10 Years, 10 Months, 2 Weeks, 2 Days, 16 Hours, 50 Minutes ago

This tutorial helps you generate all the code that is needed to create a form that allows someone to update multiple records in their database at one time. So think of a administrative back-end website. You may want a page that displays all your product categories (shirts, pants, shoes) listed down the page. Instead of listing them each with text and having to click each one to individually edit the category name, this tutorial would help you set up all the categories in text fields on ONE page so they could be edited in one swoop. Does that make sense? We can also provide technical support for this tutorial in our forums.

Mike: 10 Years, 10 Months, 4 Days, 43 Minutes ago

Hi... could you explain me how to create a multiple update about a form with checkbox (1 for Yes, 0 for No)?

I tried but without finding a good solution...
Thanks

rating

Team WebAssist: 10 Years, 10 Months, 2 Days, 17 Hours, 16 Minutes ago

Multiple update with checkboxes should work the same as multiple update with text fields. Make sure a value is assigned to your checkboxes. If it is and the server behavior still isn't working, please visit our help page or post directly to our forums to get assistance from our technical support team. We'd be happy to work through it with you.

rating

henrik441511: 10 Years, 3 Months, 1 Day, 22 Hours, 22 Minutes ago

Nice tutorial, but does the same code work with Ecart? I have a little struggle to complete that!

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

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.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.