[eluser]TheFuzzy0ne[/eluser]
First of all, you don't need to use set_value, as it's for forms. Generally, you should use $this->input->post('key') or $_POST['key'] (I prefer the first). You have two options that I can see.
Option 1:
Pass $_POST straight to your model, and have your model "extract" the required data.
Option 2:
You could extend the input library:
./system/application/libraries/MY_Input.php
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class MY_Input extends CI_Input {
function _fetch_from_array(&$array, $index = '', $xss_clean = FALSE)
{
if ($index === '')
{
$arr = array();
foreach ($array as $key => $val)
{
$arr[$key] = ($xss_clean === TRUE && ! $this->use_xss_clean) ? $this->xss_clean($val) : $val;
}
return $arr;
}
else if (is_array($index))
{
$arr = array();
foreach ($index as $key)
{
if (isset($array[$key]))
{
$arr[$key] = ($xss_clean === TRUE && ! $this->use_xss_clean) ? $this->xss_clean($array[$key]) : $array[$key];
}
else
{
$arr[$key] = FALSE;
}
}
return $arr;
}
else if ( ! isset($array[$index]))
{
return FALSE;
}
if ($xss_clean === TRUE)
{
return $this->xss_clean($array[$index]);
}
return $array[$index];
}
}
/* End of file MY_Input.php */
/* Location: ./application/libraries/MY_Input.php */
This will allow you to do something like this:
$data = $this->input->post(array('first_name', 'last_name', spouse_first', 'spouse_last', 'home_phone'));
Not specifying an argument will return the entire $_POST array (even though you don't
have to use that, as you can just use $_POST.