Example #1
0
$banker = $supplier->getbanker();
$supplier->setbankdetail($_POST['bankDetail']);
$bankdetail = $supplier->getbankdetail();
$supplier->setaccountno($_POST['accountNumber']);
$accountno = $supplier->getaccountno();
$supplier->setcreditlimit($_POST['creditLimit']);
$creditlimit = $supplier->getcreditlimit();
$supplier->setcreditperiod($_POST['creditPeriod']);
$creditperiod = $supplier->getcreditperiod();
$supplier_id = $_POST['id'];
//make a connection to the database server
$connection = $supplier->dbconnect();
$supplier->dbselect();
if (isset($_POST['addsupplier']) && !$_POST['id'] && !$_POST['mode']) {
    //add supplier information to the database
    $add = $supplier->addSupplier($companyname, $contactperson, $address1, $address2, $phone1, $phone2, $cell1, $cell2, $email, $fax, $banker, $bankdetail, $accountno, $creditlimit, $creditperiod);
    if ($add == true) {
        $message = "Supplier {$companyname} is Saved in the Database!";
    } else {
        echo 'check your query';
    }
} else {
    if (isset($_POST['addsupplier']) && $supplier_id && !$_POST['mode']) {
        //here is where updation goes
        $edit = $supplier->update_supplier($supplier_id, $companyname, $contactperson, $address1, $address2, $phone1, $phone2, $cell1, $cell2, $email, $fax, $banker, $bankdetail, $accountno, $creditlimit, $creditperiod);
        if ($edit == true) {
            $message = "Supplier {$companyname} `s informations modified succesful";
        } else {
            echo "Check query";
        }
    } else {