rendered paste bodyfunction ask() { $rules['nume'] = 'required|max_length[24]'; $rules['email'] = 'required|max_length[64]|valid_email'; $rules['intrebare'] = 'required'; $fields['nume'] = "'Nume'"; $fields['email'] = "'E-Mail'"; $fields['intrebare'] = "'Întrebare'"; $this->validation->set_rules($rules); $this->validation->set_fields($fields); if($this->validation->run()) { $this->load->database(); $query = $this->db->query('SELECT MAX(id) as id FROM intrebari'); $row = $query->row(); $entry = array( 'id' => $row->id+1, 'nume' => $_POST['nume'], 'email' => $_POST['email'], 'intrebare' => $_POST['intrebare'], 'data' => time(), ); $this->db->insert('intrebari',$entry); return ''; } else { $data['msgs'] = $this->validation->error_string; return $this->load->view('forms/intreaba.form.php',$data,true); } }