I am trying to create a dynamic link that will let the user delete a row from a mysql database based on the rows ID #.
I am also trying to input some javascript confirmation that the user really wants to delete the row in question.
My question is how to accomplish this? I have some ideas...(see below) am I on the right track?
<head>
<?php
require 'include/episodelist.db.php';
mysql_query("DELETE FROM season WHERE ID='$id'");
mysql_close();
?>
<script type="text/javascript">
function confSubmit(form) {
if (confirm("Delete this record?")) {
form.submit();
} else {
}
}
</script>
</head>
<form action="<?=$_SERVER['PHP_SELF'];?>" method="post">
<input type="button" onClick="confSubmit(this.form);" value="Delete">
</form>