Because there is no value to determine whether there is, so to re-set at:
$type=isset($_POST["type"])?$_POST["type"]:0;