Deleting a Record in a Database Using an HTML Form
In the last assignment, you allowed users to modify the data in the Access database. In this assignment, you permit users to delete records from the database. Very little modification of what you have done before will be necessary to do this. In the modify case, you likely had three pages:
- an initial page which displayed all records with a link or button for each record that when clicked takes you to the form page
- a form page which displays in a form the current values of some or all of the fields of the record you clicked in the initial page -- display in the form is necessary so that the user can modify the information
-an action page that is specified in the action attribute of the form page. The action page updates the database with any changes made by the user in the form pageFor the deletion assignment, you can use the initial page which displayed all the records.
If you created links to take you to the form page - you can add a second set of links for deletion. The delete links can take you directly to the action page or take you to a form page for display.
If you used a submit button to take you to the form page - You can have multiple submit buttons in a form -- if you give them the same name but different values, the receiving page can tell which button was clicked.
The action page for deletion can be very similar to the one you created for modification except that you use the SQL DELETE statement instead of the SQL UPDATE. Remember it's a good idea to test your WHERE clause using a SELECT statement before doing the deletion.
3. On the ASP page that does the deletion, create a link to the ASP page you created two assignments ago that displays the data-driven page. This way you and I can easily see the effect of the deletion by clicking on this link.
4. Create links from your index page to your work for this assignment, including links to the .txt version of any ASP pages, and FTP your pages to your website.
Due: Wednesday, October 23. Each of you should do this on your own, but of course feel free to ask for help from me or others if you get stuck.
Revised: October 25, 2002