You confused formatID and formatType. Instead of
$formatID = mysql_query("select formatID from format where formatType = '$format'") OR die(mysql_error());
code
$formatID = mysql_query("select formatID from format where formatID = '$format'") OR die(mysql_error());