I would like to know if below form validation is possible to do. My syntax seems ok. if it is possible how do i make it return false and quit the function (or go back to entering the code again)...btw i am no php programmer....
$this->form_validation->set_rules('customer', lang("customer"), 'trim|required');
This is the validation i need, so if false is returned it will escape the function, and give an error message
$this->form_validation->set_rules($id = mysql_real_escape_string($this->input->get('id')),
$pincode = intval($this->input->post('spos_note')),
$result = mysql_query("SELECT `cf1` FROM tec_customers WHERE id='$customer_id' AND cf1 = $pincode") or die(mysql_error()),
'if (mysql_num_rows($result) > 0))');
If validation is ok it should continue...
if ($this->form_validation->run() == true) {
$quantity = "quantity";
$product = "product";
$unit_cost = "unit_cost";
$tax_rate = "tax_rate";
$date = date('Y-m-d H:i:s');
$customer_id = $this->input->post('customer_id');
$customer_details = $this->pos_model->getCustomerByID($customer_id);
$customer = $customer_details->name;
$note = $this->tec->clear_tags($this->input->post('spos_note'));
$total = 0;
$product_tax = 0;
$order_tax = 0;
$product_discount = 0;
$order_discount = 0;
$percentage = '%';
$i = isset($_POST['product_id']) ? sizeof($_POST['product_id']) : 0;
for ($r = 0; $r < $i; $r++) {
$item_id = $_POST['product_id'][$r];
$real_unit_price = $this->tec->formatDecimal($_POST['real_unit_price'][$r]);
$item_quantity = $_POST['quantity'][$r];
$item_discount = isset($_POST['product_discount'][$r]) ? $_POST['product_discount'][$r] : '0';