$o->accounts_name = $_POST['accounts_name']; $o->defaultlevel = $_POST['defaultlevel']; $o->parentaccounts_id = $_POST['parentaccounts_id']; $o->parentaccounts_idname = $_POST['parentaccounts_idname']; $o->description = $_POST['description']; $o->accountcode_full = $_POST['accountcode_full']; $o->ishide = $_POST['ishide']; $o->tax_id = $_POST['tax_id']; $o->placeholder = $_POST['placeholder']; $o->organization_id = $_POST['organization_id']; $o->accountgroup_id = $_POST['accountgroup_id']; $o->accountgroup_idname = $_POST['accountgroup_idname']; $o->account_type = $_POST['account_type']; $o->account_typename = $_POST['account_typename']; echo "<?xml version='1.0' encoding='utf-8' ?><Result>"; if ($o->validateForm()) { if ($o->accounts_id > 0) { if ($o->updateAccounts()) { echo "<status>1</status><detail><msg>Record save successfully</msg></detail>"; } else { echo "<status>0</status><detail><msg>Cannot save record due to internal error</msg></detail>"; } } else { if ($o->insertAccounts()) { echo "<status>1</status><accounts_id id='{$o->accounts_id}'>{$o->accounts_id}</accounts_id><detail><msg>Record save successfully</msg></detail>"; } else { echo "<status>0</status><detail><msg>Cannot save record due to internal error</msg></detail>"; } } } else { $o->generateValidationError();