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="" />
</a>
It posts to delete.php where I've got this code to delete the record.
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 guysPHP Code:if ((isset($_GET['recordID'])) && ($_GET['recordID'] != "")) {
$deleteSQL = sprintf("DELETE FROM tasks WHERE id=%s",
GetSQLValueString($_GET['recordID'], "int"));
mysql_select_db($database_test, $test);
$Result1 = mysql_query($deleteSQL, $test) or die(mysql_error());
$deleteGoTo = "index.php";
if (isset($_SERVER['QUERY_STRING'])) {
$deleteGoTo .= (strpos($deleteGoTo, '?')) ? "&" : "?";
$deleteGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $deleteGoTo));
}
mysql_select_db($database_test, $test);
$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);
![]()


Reply With Quote
Bookmarks