Hi all. I'm new to php and am trying to get past something that's probably quite simple. I've got a form with a while loop showing a list of tasks. The task can be deleted with this button:

<a href="delete.php?recordID=<?php echo $row_tasks['id']; ?>">
<input type="submit" name="submit" id="submit" value="" />

It posts to delete.php where I've got this code to delete the record.

PHP Code:
if ((isset($_GET['recordID'])) && ($_GET['recordID'] != "")) {
$deleteSQL sprintf("DELETE FROM tasks WHERE id=%s",
GetSQLValueString($_GET['recordID'], "int"));

$Result1 mysql_query($deleteSQL$test) or die(mysql_error());

$deleteGoTo "index.php";
  if (isset(
$deleteGoTo .= (strpos($deleteGoTo'?')) ? "&" "?";
$deleteGoTo .= $_SERVER['QUERY_STRING'];
header(sprintf("Location: %s"$deleteGoTo));

$query_tasks "SELECT * FROM tasks";
$Recordset2 mysql_query($query_tasks$test) or die(mysql_error());
$row_tasks mysql_fetch_assoc($tasks);
$totalRows_tasks mysql_num_rows($tasks); 
I need to edit this code so the record being passed inserts into another table before it gets deleted. Can anyone point me in the right direction? Thanks guys