close ad
 
Important WebAssist Announcement
open ad
View Menu

Web development tutorial

Create a multiple record delete form

Tutorial created by Ray Borduin, WebAssist

Categories: Data Bridge, Dreamweaver, PHP

rating

When building a website where your users need to delete information in a database, you may want to allow them to delete multiple entries at once. This tutorial will demonstrate how to create a Web page that deletes multiple records stored 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_delete.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_delete.php.

  2. In the Server Behaviors panel, select +.

  3. Choose Recordset.

  4. Enter rsDelete in the Name field.

  5. Select your Connection.

  6. Select genres 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 GenreName 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 one dynamic text element (name) and one checkbox (checkbox).

  2. In design view, select the form field and the checkbox, then click the <tr> 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 Region dialog box, make sure your recordset is displayed and set Show to All records. This setting allows you to delete 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 delete multiple records server behavior

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

  2. When the Delete Multiple Records wizard opens, you’ll first select the event to execute the server behavior from the Trigger list. Select Button: delete checked items pressed.
    .
  3. In the Repeated form list, select Repeat Region (rsDelete).

  4. In the Deletion key field list, select name.

  5. 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, genres. In the Key column list, select GenreName.

  6. If you’d like to display a particular page after the delete 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.

  7. When you’re done, click OK.

  8. 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 delete multiple records in a single page.

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

Ericspecullaas: 9 Years, 3 Months, 1 Week, 15 Hours, 55 Minutes ago

i have tried this with your files on my localhost and on a server and it will not work. I have followed your instructions to the letter and still nothing. Is there a newer tutorial of this?

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.