[eluser]SitesByJoe[/eluser]
You're right. That works.
Things you can do to clean up a little more:
1. Make and use the form_validation config file (config/form_validation.php) and use it like described in the user guide.
2. You can just have one function do both operations (edit and update) using this structure:
Code:
function edit()
{
if ($this->form_validation->run('see #1') == FALSE)
{
// show the form or error messages
}
else
{
// process our form stuff into an array
$record = array('fieldname' => $this->input->post('fieldname'));
// save the record changes
$this->db->where('id', $this->input->post('id');
$this->db->update('table', $record);
// make a success message to potentially show our user
$this->session->set_flashdata('message', 'success!');
// move along to new screen
redirect('success-page');
}
}