First of all, when you share php code, please use the php button on the tool bar of the forum's editor window.
The best structure for handling forms with form validation is this:
PHP Code:
public function edit()
{
$this->load->library('form_validation');
//set rules here in $rules array
$this->form_validation->set_rules($rules);
if ($this->form_validation->run() == FALSE) {
//display your form
}
else {
//save form input to database
//redirect to page which should appear after saving data
}
}
In this case, your form view should have this line:
PHP Code:
echo form_open(); // form is posted to original url
//display fields here
//display submit button here
echo form_close();