<?php
session_start();

include "../functions.php";
checkAdmin(session_id());

if ($_POST["confirm"] == 1)
{
	$typeid = $_POST["typeid"];
	
	$query = "delete from movetype where typeid='$typeid'";
	mysql_query($query) or die (mysql_error());
	header ("location: type.php");
}
?>

<?php
include "header.php";
$typeid = $_POST["typeid"];

$query = "select typename from movetype where typeid='$typeid'";
$result = mysql_query($query) or die (mysql_error());
if ($row = mysql_fetch_array($result))
{
	$typename = $row[0];
}
?>
<center>
<table>
  <tr>
    <td align="center">Are you sure you want to delete the type: <b><?php echo $typename; ?></b>?
  </tr>
  
  <tr>
    <td align="center"><form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post"><input type="hidden" name="confirm" value="1"><input type="hidden" name="typeid" value="<?php echo $typeid; ?>"><input type="submit" value="Yes"></td></form>
  </tr>
  
  <tr>
    <td align="center"><form action="type.php" method="get"><input type="submit" value=" No "></td></form>
  </tr>
</table>
</center>

<?php
include "footer.php";
?>