public function Luu_sdt() { $data = array('status' => "failed", 'error' => true, 'message' => "Vui lòng nhập lại số điện thoại."); $sdt = trim($this->input->post('sodt')); if (!$this->input->post('sodt') || strlen(trim($this->input->post('sodt'))) < 10 || strlen(trim($this->input->post('sodt'))) > 11) { echo json_encode($data); exit; } $benhtvDB = new BenhtvDB(); if ($khoa = $this->input->post('khoa')) { $kq = $benhtvDB->LuuSDT($sdt, $khoa); } else { $kq = $benhtvDB->LuuSDT_Nhanh($sdt); } if ($kq) { $data['status'] = "success"; $data['error'] = false; $data['message'] = "Lưu số điện thoại thành công"; } echo json_encode($data); exit; }