I have one form for the edit and create for a user. On the form I have an if statement that if the form is an edit then it places a hidden form element that holds the value of the user being updated.
When I value the form on the php side controller this is what I’m using to do it with.
$user_id = $this->input->post('user_id');
if (isset($user_id_id))
{
$this->form_validation->set_rules('user_id', 'User ID', 'required|trim|xss_clean|integer');
}
I have not tested this on the edit form but on the add form it is saying that the user id is requred and I’m not sure why.
You can simply use