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.


$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());
$note = "";
<meta http-equiv="Content-Type" content="text/html;
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'];?>">
<input type="submit" name="SUBMIT" value="Cancel">
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']."' >";