コード例 #1
0
function doEdit()
{
    if (isset($_POST['submit'])) {
        $IDNO = $_POST['idno'];
        $LNAME = $_POST['lName'];
        $FNAME = $_POST['fName'];
        $MNAME = $_POST['mName'];
        $SEX = $_POST['gender'];
        $BDAY = $_POST['bday'];
        $BPLACE = $_POST['bplace'];
        $STATUS = $_POST['status'];
        $AGE = $_POST['age'];
        $NATIONALITY = $_POST['nationality'];
        $RELIGION = $_POST['religion'];
        $CONTACT_NO = $_POST['contact'];
        $HOME_ADD = $_POST['home'];
        $EMAIL = $_POST['email'];
        $student = new Student();
        //$student->S_ID				= "null";
        $student->IDNO = $IDNO;
        $student->LNAME = $LNAME;
        $student->FNAME = $FNAME;
        $student->MNAME = $MNAME;
        $student->SEX = $SEX;
        $student->BDAY = $BDAY;
        $student->BPLACE = $BPLACE;
        $student->STATUS = $STATUS;
        $student->AGE = $AGE;
        $student->NATIONALITY = $NATIONALITY;
        $student->RELIGION = $RELIGION;
        $student->CONTACT_NO = $CONTACT_NO;
        $student->HOME_ADD = $HOME_ADD;
        $student->EMAIL = $EMAIL;
        //course infor
        /*$course	= $_POST['course'];
        $semester = $_POST['semester'];
        $ay		= $_POST['AY'];
        $sy = new Schoolyr();
        $sy->AY 		= $ay;
        $sy->SEMESTER 	= $semester;
        $sy->COURSE_ID	= $course;
        $sy->IDNO 		= $IDNO;*/
        /*if ($istrue) {
        	output_message('course info successfully added!');
        	redirect ('newstudent.php');
        }
        
        */
        //secondary Details
        $FATHER = $_POST['father'];
        $FATHER_OCCU = $_POST['fOccu'];
        $MOTHER = $_POST['mother'];
        $MOTHER_OCCU = $_POST['mOccu'];
        $BOARDING = $_POST['boarding'];
        $WITH_FAMILY = $_POST['withfamily'];
        $GUARDIAN = $_POST['guardian'];
        $GUARDIAN_ADDRESS = $_POST['guardianAdd'];
        $OTHER_PERSON_SUPPORT = $_POST['otherperson'];
        $ADDRESS = $_POST['otherAddress'];
        $studdetails = new Student_details();
        $studdetails->FATHER = $FATHER;
        $studdetails->FATHER_OCCU = $FATHER_OCCU;
        $studdetails->MOTHER = $MOTHER;
        $studdetails->MOTHER_OCCU = $MOTHER_OCCU;
        $studdetails->BOARDING = $BOARDING;
        $studdetails->WITH_FAMILY = $WITH_FAMILY;
        $studdetails->GUARDIAN = $GUARDIAN;
        $studdetails->GUARDIAN_ADDRESS = $GUARDIAN_ADDRESS;
        $studdetails->OTHER_PERSON_SUPPORT = $OTHER_PERSON_SUPPORT;
        $studdetails->ADDRESS = $ADDRESS;
        $studdetails->IDNO = $IDNO;
        //
        /*if ($istrue) {
        	output_message('Seccondary details successfully added!');
        	redirect ('newstudent.php');
        }
        */
        //requirements
        $nso = isset($_POST['nso']) ? "Yes" : "No";
        $bapt = isset($_POST['baptismal']) ? "Yes" : "No";
        $entrance = isset($_POST['entrance']) ? "Yes" : "No";
        $mir_contract = isset($_POST['mir_contract']) ? "Yes" : "No";
        $certifcateOfTransfer = isset($_POST['certifcateOfTransfer']) ? "Yes" : "No";
        $requirements = new Requirements();
        $requirements->NSO = $nso;
        $requirements->BAPTISMAL = $bapt;
        $requirements->ENTRANCE_TEST_RESULT = $entrance;
        $requirements->MARRIAGE_CONTRACT = $mir_contract;
        $requirements->CERTIFICATE_OF_TRANSFER = $certifcateOfTransfer;
        $requirements->IDNO = $IDNO;
        //$istrue = $requirements->create();
        /*if ($istrue) {
        	output_message('Student requirements successfully added!');
        	redirect ('newstudent.php');
        } 
        */
        if ($IDNO == "") {
            message('ID Number is required!', "error");
            redirect('index.php?view=edit&id=' . $IDNO);
        } elseif ($LNAME == "") {
            message('Last Name is required!', "error");
            redirect('index.php?view=edit&id=' . $IDNO);
        } elseif ($FNAME == "") {
            message('First Name is required!', "error");
            redirect('index.php?view=edit&id=' . $IDNO);
        } elseif ($MNAME == "") {
            message('Middle Name is required!', "error");
            redirect('index.php?view=edit&id=' . $IDNO);
        } elseif ($EMAIL == "") {
            message('Email address is required!', "error");
            redirect('index.php?view=edit&id=' . $IDNO);
        } else {
            $student->update($_GET['id']);
            //$sy->update($_GET['id']);
            $studdetails->update($_GET['id']);
            $requirements->update($_GET['id']);
            message('Student infomation updated successfully!', "info");
            redirect('index.php');
        }
    }
}