I faced something just like this a couple months ago. I just added a short if-statement.
It looked something like this (using address for example):
$this->form_validation->set_rules('home_address', '"Home Address"', 'required|trim|xss_clean|strip_tags');
$this->form_validation->set_rules('unit', '"Unit"', 'trim|xss_clean|strip_tags');
$this->form_validation->set_rules('city', '"City"', 'required|trim|xss_clean|strip_tags');
$this->form_validation->set_rules('state', '"State"', 'required|trim|xss_clean|strip_tags');
$this->form_validation->set_rules('zip', '"Zip"', 'required|trim|xss_clean|strip_tags');
//checkbox formatted like this in the view: form_checkbox('has_second_address', 'accept');
if ($this->input->post('has_second_address') == 'accept')
{
$this->form_validation->set_rules('street_address_2', '"Street Address 2"', 'required|trim|xss_clean|strip_tags');
$this->form_validation->set_rules('state_2', '"State 2"', 'required|trim|xss_clean|strip_tags');
$this->form_validation->set_rules('city_2', '"City 2"', 'required|trim|xss_clean|strip_tags');
$this->form_validation->set_rules('zip_2', '"Zip 2"', 'required|trim|xss_clean|strip_tags');
}
if($this->form_validation->run() == true) {
//example
//will return FALSE if empty
$street_address_2 = $this->input->post('street_address_2');
//and so on...
}
I'm not sure if this is the Codeigniter way or not, but last time I checked I couldn't find a "best method" way. This definitely gets the job done, and it at minimum allows you to take control over a users $_POST variables.
Anyways, I hope this helps