close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Web development tutorial

Create a multiple record insert form

Tutorial created by Kate Ford

Categories: Data Bridge, Dreamweaver, PHP

rating

When building a website where your users need to insert information into a database, you may want to allow them to submit multiple entries at once. This tutorial will demonstrate how to take a simple form and use Data Bridge or DataAssist to convert it into a multiple record insert form.

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_1.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 downSet up your form for multiple records

Inserting multiple records requires two main steps. First you will set up the number of records you’d like the user to be able to insert.

1. Open the sample file in your site. Each of your form elements should have unique names. This example has 4 text fields: First Name (FN), Last Name (LN), Username (UN), and Password (PW).

2. Placing your cursor in the form element row, choose the <tr> tag from the Tag Selector.


3. From the Server Behaviors panel, click + and choose WebAssist > DataAssist > Repeat Selection.

4. In DataAssist Repeat Selection, leave the Recordset list set to None. Because you’re specifying a set value of entries to repeat, there’s no need to loop through a recordset.

5. Set the Repetitions to the number of entries you’d like. For example, 5. Click OK.


6. Take note that Dreamweaver has surrounded the table row with a Repeat Selection tab and border.


7. Save your page. (Ctrl or Cmd + S)

arrow downAdd the multiple records server behavior

Now that the multiple rows have been defined, let’s apply the Multiple Record Inserts server behavior.

1. From the Server Behaviors panel, click + and choose WebAssist > DataAssist > Insert > Multiple Record Inserts.

2. When the Insert Multiple Records wizard opens, select the event to execute the server behavior from the Trigger list by choosing Button: submit pressed.

3. Next, choose the repeat selection that holds the form elements you want reiterated. In this situation, there is only one repeat selection available. So you can leave the default setting, Repeat Selection (5).

4. From the Skip if empty list, choose the primary field you want to make sure is entered. Let’s choose Last Name (LN). Alternatively, you could choose Always insert to force every data row to create a record, regardless of whether the data entered is complete or not.

5. In the Database section, choose the desired database connection from the Connection list. In this example, the database is tut_00_11. Then choose the table you want to insert the records into from the Table list.

6. If you’d like to display a particular page after the insert operation is complete, enter its path and filename in the Go to (optional) field or select the page by clicking the folder icon. To see that your records have been added, select the results page.


7. On the second step of the Insert Multiple Records wizard, you’ll bind the database columns in the chosen table to the form fields on the current page. Click the Bindings tab.

8. Select each database column into which you want to enter data from the Column list and then, if necessary, modify the Data Type.

9. Finally, click the lightning bolt icon to open the Dynamic Data dialog and then expand the form entry to locate the proper field. Click OK once to return to the Insert Multiple Records wizard and repeat this step for the next required database column.

10. Since the form contains entries for the visitor’s first name, last name, username and password, select the corresponding database columns and bind them. Click Finish.


11. Save your page (Ctrl or Cmd + S) and preview (F12) to see your 5 entries rows.


Now your application is ready to accept multiple records in a single page.

DataAssist also allows you to create a multiple record update form and a multiple record delete form. View the tutorials at Create a multiple record update 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

info4753: 4 Years, 6 Months, 4 Weeks, 11 Hours, 13 Minutes ago

How do I create a form with flexible amount of field rows? When do we see a multiple file upload from WebAssist?

rating

henrik441511: 3 Years, 11 Months, 1 Week, 6 Days, 18 Hours, 23 Minutes ago

Nice tutorial when it comes to ordinary repeat selection.
But what about Ecart repeat region? How to make insert multiple records in Ecart?
As in http://assets.webassist.com/technotes/ecart_multiple_atc.pdf regarding select multiple items from list and add at once.

rating

Anna Robinson: 3 Years, 11 Months, 1 Week, 5 Days, 23 Hours, 49 Minutes ago

info4753, As far as features you would like to see, visit http://www.webassist.com/go/vote to vote on new features!

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.