$start = $_POST['start_date']; $end = $_POST['end_date']; $type = $session->sessionVar('type'); if (empty($cheque_no) || empty($bank) || empty($branch) || empty($drawer) || empty($start) || empty($end)) { $err = "Form fields marked with an asterix are required"; } else { $cheque = new Cheque(); $cheque->setTenantId($tenant_id); $cheque->setChequeNo($cheque_no); $cheque->setBank($bank); $cheque->setBranch($branch); $cheque->setDrawer($drawer); $cheque->setStartPeriod($start); $cheque->setEndPeriod($end); $cheque->setDatePaid(); $cheque->setPaymentType($type); /*echo var_dump($cheque); echo var_dump($session->sessionVar("type"));*/ if ($cheque->save()) { $mesg = "Payment posted"; $session->message($mesg); redirect_to("receipt.php?tid={$tenant_id}&id={$last_id}&type={$type}"); } else { $err = "An error occured preventing the cheque details from being saved. Please try again later"; } } } else { // Form not submitted $err = ""; } include_layout_template("admin_header.php");