function Main() { $cod = $_POST["c"]; $des = urldecode($_POST["d"]); header('Content-Type: text/html; charset=iso-8859-1'); try { $g = new Grupo(); if ($cod != "") { $g->setCodigo($cod); } if ($des != "") { $g->setDescricao($des); } if ($cod == "") { if ($g->AdicionaGrupoUsuario()) { echo "GRAVADO"; } } else { if ($g->AtualizaGrupoUsuario()) { echo "GRAVADO"; } } } catch (Exception $ex) { echo $ex->getMessage(); } }