<?php

require_once "../../inc/initialize.php";
$database = new MySQLDatabase();
if (isset($_POST)) {
    $AdmAccess = new AdmAccess();
    $AdmAccess->db_fields = array('jamb_rem_no', 'pin', 'amount', 'payment_date', 'ip_addr', 'payment_code', 'branch_code', 'bank_code', 'reg_num', 'full_name', 'status');
    $AdmAccess->jamb_rem_no = $_POST['applicant_number'];
    $AdmAccess->pin = $_POST['access_code'];
    $AdmAccess->amount = $_POST['amount'] * 100 . ".00";
    $AdmAccess->payment_date = $_POST['transaction_date'];
    $AdmAccess->ip_addr = $_POST['ip_address'];
    $AdmAccess->branch_code = $_POST['branch_code'];
    $AdmAccess->reg_num = $_POST['applicant_number'];
    $AdmAccess->full_name = $_POST['full_name'];
    $AdmAccess->status = $_POST['student_status'];
    /*print_r($AdmAccess);
    		die();*/
    if ($AdmAccess->save()) {
        echo '<h4 class="alert alert-success">Success</h4>';
        echo '<hr>';
        echo "<p>You have successfully added a new record into acceptance log for applicant with application number: " . $AdmAccess->jamb_rem_no . ".</p>";
        echo '<hr>';
    } else {
        echo '<h4 class="alert alert-error">Error</h4>';
        echo '<hr>';
        echo "Failed to insert into acceptance log.";
        echo '<hr>';
    }
}
    $acceptance->student_id = $form_no;
    $acceptance->ResponseCode = $ResponseCode;
    $acceptance->ResponseDescription = $ResponseDescription;
    $acceptance->Amount = $amount / 100;
    $acceptance->returned_amount = $amount . '.00';
    $acceptance->MerchantReference = $PaymentReference;
    $acceptance->PaymentReference = $RefNumb;
    $acceptance->Interswitch_date = $TranxDate;
    $acceptance->status = $Applicant_detail->student_status;
    if (!empty($acc_id_final)) {
        $acceptance->id = $acc_id_final->id;
    } else {
        $acceptance->Initiating_date = date('Y-m-d H:i:s');
    }
    // Save Record into Table acceptance_log or update as the need be
    $acceptance->save();
    echo "done";
} elseif (isset($_POST['action']) && $_POST['action'] == 'insertaccesscode') {
    $adm = new AdmAccess();
    $adm->jamb_rem_no = $form_no;
    $adm->pin = $RefNumb;
    $adm->amount = $amount . '.00';
    $adm->payment_date = $TranxDate;
    $adm->payment_code = $RetRefNumb;
    $adm->reg_num = $form_no;
    $adm->full_name = $Applicant_detail->surname . " " . $Applicant_detail->first_name . " " . $Applicant_detail->middle_name;
    $adm->status = $Applicant_detail->student_status;
    // Save Record into Table adm_access_code
    $adm->save();
    echo 'done';
}
<?php

require_once "../../inc/initialize.php";
$adm = new AdmAccess();
$adm->id = $_POST['adm_id'];
$adm->pin = $_POST['access_code'];
$adm->amount = $_POST['amount'] * 100 . '.00';
$adm->payment_date = $_POST['transaction_date'];
$adm->ip_addr = $_POST['ip_address'];
$adm->payment_code = $_POST['payment_code'];
$adm->branch_code = $_POST['branch_code'];
$adm->full_name = $_POST['full_name'];
$adm->status = $_POST['student_status'];
$adm->db_fields = array('pin', 'amount', 'payment_date', 'ip_addr', 'payment_code', 'branch_code', 'bank_code', 'full_name', 'status');
if ($adm->save()) {
    echo '<h4 class="alert alert-success">Success</h4>';
    echo '<hr>';
    echo "You have successfully edited the payment record for applicant with application number: " . $_POST['applicant_number'];
    echo '<hr>';
} else {
    echo '<h4 class="alert alert-error">Error</h4>';
    echo '<hr>';
    echo "Your updates were not saved";
}