Saturday, 24 August 2013

Problem, Save users in database using CodeIgniter [on hold]

Problem, Save users in database using CodeIgniter [on hold]

Hi I want to send my form data to a database, the problem is not saved.
Help please
Controller user:
<?php
public function edit($id = NULL)
{
if($id){
$this->data['user'] = $this->user_m->get($id);
count($this->data['user']) || $this->data['errors'][] = 'User
could not be fount';
}
else{
$this->data['user'] = $this->user_m->get_new();
}
$rules = $this->user_m->rules_admin;
$id || $rules['password']['rules'] .= '|required';
$this->form_validation->set_rules($rules);
if ($this->form_validation->run() == TRUE) {
$data =
$this->user_m->array_from_post(array('name','email','password'));
$data['password'] = $this->user_m->md5($data['password']);
$this->user_m->save($data, $id);
redirect('index.php/admin/user');
}
$this->data['subview'] = 'admin/user/edit';
$this->load->view('admin/_layout_main', $this->data);
}
Thank's!

No comments:

Post a Comment