// Field Error Checking if ($_POST['servicegroup_name'] == '' || $_POST['alias'] == '') { $error = "Fields shown are required and cannot be left blank."; } else { // All is well for error checking, add the servicegroup into the db. $serviceGroup = new NagiosServiceGroup(); $serviceGroup->setName($_POST['servicegroup_name']); $serviceGroup->setAlias($_POST['alias']); $serviceGroup->save(); header("Location: servicegroups.php?id=" . $serviceGroup->getId()); die; } } } else { if ($_POST['request'] == 'modify_servicegroup') { if ($_POST['servicegroup_name'] != $serviceGroup->getName() && $lilac->servicegroup_exists($_POST['servicegroup_name'])) { $error = "A service group with that name already exists!"; } else { // Error check! // Field Error Checking if ($_POST['servicegroup_name'] == '' || $_POST['alias'] == '') { $addError = 1; $error = "Fields shown are required and cannot be left blank."; } else { // All is well for error checking, modify the group. $serviceGroup->setName($_POST['servicegroup_name']); $serviceGroup->setAlias($_POST['alias']); $serviceGroup->save(); $success = "Service group modified."; unset($_GET['edit']); }