
Kolejny problem jest nastepujący przy pustym polu i zapisaniu. Wyswietla pustą tabele w bazie a powinno ustawic na NULL
public function edit() { if ($this->input->post('edit')) { if ($this->input->post('pass') != '' && $this->input->post('pass_c') != '') { $this->form_validation->set_rules('pass', '', 'trim|required|xss_clean|callback__html2txt'); $this->form_validation->set_rules('pass_c', '', 'trim|required|xss_clean|callback__html2txt|matches[pass]'); } $this->form_validation->set_rules('name', '', 'trim|required|xss_clean|callback__html2txt'); $this->form_validation->set_rules('dd', '', 'required|xss_clean'); $this->form_validation->set_rules('mm', '', 'required|xss_clean'); $this->form_validation->set_rules('yy', '', 'required|xss_clean'); $this->form_validation->set_rules('city', '', 'trim|xss_clean|callback__html2txt'); $this->form_validation->set_rules('email', '', 'trim|xss_clean|callback__html2txt|valid_email'); $this->form_validation->set_rules('gg', '', 'trim|xss_clean|callback__html2txt'); $this->form_validation->set_rules('music', '', 'trim|xss_clean|callback__html2txt'); $this->form_validation->set_rules('zainteresowania', '', 'trim|xss_clean|callback__html2txt'); if ($this->input->post('dd') == 0 || $this->input->post('mm') == 0 || $this->input->post('yy') == 0 or $this->form_validation->run() == FALSE) { $this->session->set_flashdata('error', 'W formularzu wystąpiły błędy, któreś pole zostało wypełnione nieprawidłowo.'); redirect('profile/index'); } else { $id = $this->session->userdata('user_id'); if ($this->input->post('pass') != '' && $this->input->post('pass_c') != '') { $data['pass'] = $this->input->post('pass'); } $data['name'] = $this->input->post('name'); $data['user_dd'] = $this->input->post('dd'); $data['user_mm'] = $this->input->post('mm'); $data['user_yy'] = $this->input->post('yy'); $data['city'] = $this->input->post('city'); $data['email'] = $this->input->post('email'); $data['gg'] = $this->input->post('gg'); $data['music'] = $this->input->post('music'); $data['zainteresowania'] = $this->input->post('zainteresowania'); $this->Profile_model->editUser($data, $id); redirect('profile/index'); } } else redirect('profile/index'); }