// check same schoolcode. $conditions = array( 'School.school_code' => $data['School']['school_code'], ); if ($this->School->hasAny($conditions)) { $this->Session->setFlash(__('school_code_is_exist'), 'flash/error'); goto load_data; }