$mt->ColorID = $_POST['mtcc']; if (isset($_POST['mtid'])) { // If set we're updating an existing entry $mt->MediaID = $_POST['mtid']; if (isset($_POST['original'])) { $mt->GetType(); header('Content-Type: application/json'); echo json_encode($mt); exit; } if (isset($_POST['clear']) || isset($_POST['change'])) { if (isset($_POST['clear'])) { MediaTypes::ResetType($mt->MediaID); } else { $newmediaid = $_POST['change']; MediaTypes::ResetType($mt->MediaID, $newmediaid); } if ($mt->DeleteType()) { echo 'u'; } else { echo 'f'; } exit; } if ($mt->UpdateType()) { echo 'u'; } else { echo 'f'; } } else { if ($mt->CreateType()) {