It looks like you're new here. If you want to get involved, click one of these buttons!
function updateOrder() {
 $this->load->helper('form');
 $this->load->model('tank_auth/users');
 $this->load->library('form_validation');
		
 if(empty($_POST))
  $orderId = $this->uri->segment(3);
 else
  $orderId = $this->input->post('orderId');
  $row = $this->admin_model->getOrder($orderId);
  $userId = $row->user_id;
  $data['userId'] = $userId;
  $data['cancelled'] = $row->cancelled;
  $data['date'] = $row->order_date;
  $invoiceNo = $row->invoice_no;
  $paid = $row->paid;
  $trackingNo = $row->tracking_no;
  $customerName = $this->users->getUserName($userId);
  $data['firstName'] = $customerName->first_name;
  $data['lastName'] = $customerName->last_name;
  $this->load->model('order/orderonline_model');
  $data['company'] = $this->orderonline_model->getOrderCompany($userId, $orderId);
  $data['msg'] = '';
		
  if(empty($_POST)):
   $data['orderId'] = $orderId;
   $data['invoiceNo'] = $invoiceNo;
   $data['paid'] = $paid;
   $data['trackingNo1'] = substr($trackingNo, 0, 2);
   $data['trackingNo2'] = substr($trackingNo, 2, 9);
   $data['trackingNo3'] = substr($trackingNo, 10, 2);
  else: //form posted
   $this->load->library('form_validation');
	
   $data['cancelled'] = false;
   $data['orderId'] = $this->input->post('orderId');
   $data['date'] = $this->input->post('date');
   $data['userId'] = $this->input->post('userId');
   $data['invoiceNo'] = $this->security->xss_clean($this->input->post('invoiceNo'));
   $data['paid'] = $this->input->post('paid');
   $data['trackingNo1'] = $this->security->xss_clean($this->input->post('trackingNo1'));
   $data['trackingNo2'] = $this->security->xss_clean($this->input->post('trackingNo2'));
   $data['trackingNo3'] = $this->security->xss_clean($this->input->post('trackingNo3'));
   $postTrackingNo = strtoupper($data['trackingNo1']) . $data['trackingNo2'] . strtoupper($data['trackingNo3']);
  if($data['invoiceNo'] != $invoiceNo):
   $this->load->model('admin_model');
   $this->admin_model->updateOrder($data['orderId'], 'invoice_no', $data['invoiceNo']);
   $data['msg'] = '<p>The invoice number was updated succesuflly.</p>';
  endif;//Update invoice no
  if($data['paid'] == 'Yes' && $paid == 'No'):
   $row = $this->admin_model->getOrder($orderId);
   $view = 'admin/paymentconfirm_view';
   $subject = 'Payment recieved';
   $orderDets = array('orderId'=>$data['orderId'], 'invoiceNo'=>$data['invoiceNo'], 'trackingNo'=>$trackingNo, 'date'=>$data['date']);
   $result = $this->sendemail($userId, $orderDets, $view, $subject);
  if($result):
   $this->admin_model->updateOrder($data['orderId'], 'paid', 'Yes');
   $data['msg'] .= '<p>The order has been updated as Paid and an email has been sent to the customer.</p>';
  else:
   $data['msg'] .= '<p><span class="error">Error trying to update Paid: There was a problem seding email to customer: ' . $this->email->print_debugger() . ', Please <a href="contact">contact the site administrator.</a></span></p>';
  endif;
endif;//End paid
			
if($postTrackingNo != $trackingNo && $trackingNo == ''):
  $this->form_validation->set_rules('trackingNo1', 'first part of Tracking No', 'required|alpha|min_length[2]|max_length[2]');
  $this->form_validation->set_rules('trackingNo2', 'second part of Tracking No', 'required|numeric|min_length[9]|max_length[9]');
  $this->form_validation->set_rules('trackingNo3', 'third part of Tracking No', 'required|alpha|min_length[2]|max_length[2]');
/***********PROBLEM HERE *****************/
  if($this -> form_validation -> run() === TRUE):
   $view = 'admin/trackingno_view';
   $subject = 'Your coffee has been posted.';
   $orderDets = array('orderId'=>$data['orderId'], 'invoiceNo'=>$data['invoiceNo'], 'trackingNo'=>$postTrackingNo, 'date'=>$data['date']);
  $result = $this->sendemail($userId, $orderDets, $view, $subject);
					
  if($result):
   $this->admin_model->updateOrder($data['orderId'], 'tracking_no', $postTrackingNo);
   $data['msg'] .= '<p>The tracking number has been updated and an email has been sent to the customer.</p>';
  else: $data['msg'] .= '<p><span class="error">Error trying to update the tracking number: There was a problem seding email to customer: ' . $this->email->print_debugger() . ', Please <a href="contact">contact the site administrator.</a></span></p>';
  endif;
endif;//End validation success
endif;//End tracking number
endif;
$this->load->view('admin/manageorder_view', $data);
}
                
Comments
For example, these didn't work:
Coffee order - Highland coffee roastery - your order has been posted
Coffee order - Highland coffee roastery - your order is on the way
But these work fine:
Coffee order - your is on the way
Coffee order - your coffee is on the way
Coffee order - Highland coffee roastery - coffee
If so, $this->email->print_debugger() may have some info.
Read this too:
http://stackoverflow.com/questions/8350865/malformed-email-subject-header-when-subject-75-chars-using-codeigniter-email-l
$config['crlf'] = "\r\n";to$config['crlf'] = "\n";that helped.