--- a/getAgency.php +++ b/getAgency.php @@ -31,8 +31,9 @@ } else { if (strpos($key, "_") === 0) { echo""; + } else if ($key == "parentOrg") { - echo ""; $rows = $db->get_view("app", "byDeptStateName")->rows; //print_r($rows); foreach ($rows as $row) { @@ -40,7 +41,7 @@ } echo" "; } else if (strpos($key, "has") === 0) { - echo ""; + echo ""; } else { echo ""; if ((strpos($key,"URL") > 0 || $key == 'website')&& $value != "") { @@ -89,13 +90,21 @@ //print_r($row); if (sizeof($_POST) > 0) { //print_r($_POST); + foreach ($_POST as $postkey => $postvalue) { + if ($postvalue == "") { + unset($_POST[$postkey]); + } + if (is_array($postvalue) && count($postvalue) == 1 && $postvalue[0] == "") { + unset($_POST[$postkey]); + } + } if (isset($_POST['_id']) && $db->get_rev($_POST['_id']) == $_POST['_rev']) { echo "Edited version was latest version, continue saving"; $newdoc = $_POST; $newdoc['metadata']['lastModified'] = time(); $row = $db->save($newdoc); } else { - echo "ALERT doc revised by someone else while editing."; + echo "ALERT doc revised by someone else while editing. Document not saved."; } }