Need help in delete script


here my php scripts


1) In the delete script the delete option is working after twice or thrice button clicks and both delete and cancel buttons are working in the same action. But usually Cancel should not function as delete.


DELETE.PHP

<?php
$link = mysql_connect("localhost", "root", "")
or die("Could not connect: " . mysql_error());
mysql_select_db('taskmangment', $link)
or die ( mysql_error());

switch ($_GET['action']) {
case "delete":
$sql = "DELETE FROM AddJob WHERE note_id='" . mysql_real_escape_string($_GET['id']) . "'";
$result = mysql_query($sql)
or die("Invalid query: " . mysql_error());
break;
default:
$note = "";
break;
}
?>
<html>
<head>
<title>Delete</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
</head>
<body>
<center>
Are you sure do you want delete this?
<form name="Form1" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="GET">
<input type="submit" name="SUBMIT" value="<?php echo $_GET['action'];?>">
&nbsp;&nbsp;&nbsp;&nbsp;
<input type="submit" name="SUBMIT" value="Cancel">
<?php
echo "
<input type='hidden' name='action' id='action' value='".$_GET['action']."' >
<input type='hidden' name='type' id='type' value='change' >
<input type='hidden' name='id' id='id' value='".$_GET['note_id']."' >";
?>
</center>
</body>
</html>