This following code is used by the Bigwinds disc golf club in Hood River to update their list of disc golf courses in the area. I've stripped some of the details out of the code to clarify the sample and for security reasons. The code is php. When called, with a record id, the template first checks if we're doing a 'delete' or a 'modification'. If it's a 'delete' it displays a verification page before proceeding with the record deletion, if it's a 'modification' it updates the database and returns a confirmation page.
if (isset($_GET[delete])) {
// if we've got a verified delete, do it
$link = mysql_connect('localhost', '_acct_', '_pass_}') or die('Could not connect: ' . mysql_error());
@mysql_select_db(_acct_) or die('unable to select database');
$query="DELETE FROM table_name WHERE table_id = $_GET[delete]";
mysql_query($query);
mysql_close();
// show them what happened
$title="Record Deleted";
INCLUDE("header.php");
}
ELSEIF (IsSet($_POST[delete])) {
// or if it's a delete, verify it
// start our page
$title = "Are You Sure?";
INCLUDE("header.php");
//ask if they really want to delete
echo "<CENTER>Do you really want to delete <br>$_POST[table_name] ?";
echo "<p>
<a href=\"courses_list.php\">Oops, take me back</a>
 :  :
<a href=\"template_name.php?delete=$_POST[table_id]\"> Yes! Ice 'em!</a>";
}
else {
// or it's an update, do it
$link = mysql_connect('localhost', '_acct_', '_pass_}') or die('Could not connect: ' . mysql_error());
@mysql_select_db(_acct_) or die('unable to select database');
$query="UPDATE table
SET table_field1 = '$_POST[field1]',
table_field2 = '$_POST[field2]',
table_field3= '$_POSTfield3]',
table_field4 = '$_POST[field4]'
WHERE table_id = $_POST[table_id]";
mysql_query($query);
mysql_close();