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.
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 commentsYour 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.
dee: 11 Years, 7 Months, 2 Weeks, 7 Hours, 43 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
Team WebAssist: 11 Years, 7 Months, 1 Week, 6 Days, 21 Hours, 29 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: 11 Years, 7 Months, 1 Day, 5 Hours, 22 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
Team WebAssist: 11 Years, 6 Months, 4 Weeks, 2 Days, 21 Hours, 55 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.
henrik441511: 10 Years, 11 Months, 3 Weeks, 2 Days, 3 Hours, 1 Minute ago
Nice tutorial, but does the same code work with Ecart? I have a little struggle to complete that!