After creating a confirmation page (see Displaying the record on the confirmation page (PHP)), the next step in building a record delete page is to add logic to the confirmation page that deletes the record from the database when the user clicks the Confirm button. You can add this logic quickly and easily in Dreamweaver with the Delete Record server behavior.
The Delete Record dialog box appears.
You specify the primary key value later in the dialog box.
The Delete Record server behavior will search this column for a match. The column should contain the same record ID data as the recordset column you bound to the hidden form field on the page.
If the record ID is numeric, select the Numeric option.
The variable is created by your hidden form field. It has the same name as the name attribute of the hidden field and is either a form or URL parameter, depending on the forms method attribute. In our example, the variable is a form variable called hiddenRecID.
You can specify a page that contains a brief success message to the user, or a page listing the remaining records so that the user can verify that the record has been deleted.
The completed Delete Record dialog box should look as follows:
Upload the pages to your web server (if required), open a browser and search for a record to delete. When you click a Delete link on the results page, the confirmation page appears. Click the Confirm button to delete the record from the database. To verify that the record has been deleted, open the page with the Delete links again. The record no longer appears in the list.
NOTE |
|
Click Refresh if the record still appears on the page. |