#**************************************************************************** #* Validate data #**************************************************************************** $scl = new School(); $scl->setSchoolCode($_POST["schoolCode"]); $_POST["schoolCode"] = $scl->getSchoolCode(); $scl->setLastChangeUserid($_SESSION["userid"]); $scl->setSchoolName($_POST["schoolName"]); $_POST["schoolName"] = $scl->getSchoolName(); $scl->setSchoolAddress($_POST["schoolAddress"]); $_POST["schoolAddress"] = $scl->getSchoolAddress(); $scl->setContactNumber($_POST["contactNumber"]); $_POST["contactNumber"] = $scl->getContactNumber(); $scl->setcontactPerson($_POST["contactPerson"]); $_POST["contactPerson"] = $scl->getContactPerson(); $scl->setEmail($_POST["email"]); $_POST["email"] = $scl->getEmail(); $validData = $scl->validateData(); if (!$validData) { $pageErrors["schoolName"] = $scl->getSchoolNameError(); $_SESSION["postVars"] = $_POST; $_SESSION["pageErrors"] = $pageErrors; header("Location: ../circ/scl_new_form.php"); exit; } #************************************************************************** #* Insert new library school #************************************************************************** $sclQ = new SchoolQuery(); $sclQ->connect(); $sclid = $sclQ->insert($scl);
function _mkObj($array) { $scl = new School(); $scl->setSchoolid($array["schoolid"]); $scl->setLastChangeDt($array["last_change_dt"]); $scl->setLastChangeUserid($array["last_change_userid"]); $scl->setContactNumber($array["contact_number"]); $scl->setcontactPerson($array["contact_person"]); $scl->setSchoolAddress($array["school_address"]); $scl->setSchoolName($array["school_name"]); $scl->setSchoolCode($array["school_code"]); $scl->setEmail($array["email"]); return $scl; }