How to use hyperlinks to remove data from DB
Posted: Thu Jun 13, 2002 11:56 am
I have a form which displays one employee record at a time, with different training courses and a link next to each course to Remove the course from MySQL. The problem is, is when I click on the link to delete a course, it removes it from the DB, but it physically stays on the page until the page is refreshed. I want something like PHPMYADMIN when a record is deleted the browser is refreshed automatically and that one row is now gone. The form comes from a previous page where the admin can click on an employee name to display these courses with this:
I do have the form Cached with the following code:
And heres the code I have to display the link and the query to delete it:
I hope its clear as to what Im trying to do....does anyone know why this is happening?? Thanks for any help
Code: Select all
echo "<a href='markcourse.php?key=$rowїEmpkey]&lastname=$rowїLastName]&firstname=$rowїFirstName]'>$rowїLastName], $rowїFirstName]</a>\r\n";Code: Select all
//sets expires to date in the past, last modified to current time
header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header ("Pragma: no-cache"); // HTTP/1.0Code: Select all
if (isset($act))
mysql_query("DELETE FROM Schedule WHERE Schkey= '$act'") or die(mysql_error());
echo "<a onclick='return confirmSubmit()'href = "$PHP_SELF?key=$userkey&lastname=$lname&firstname=$fname&act=$rowsїSchkey]">Remove</a>\r\n";I hope its clear as to what Im trying to do....does anyone know why this is happening?? Thanks for any help