[eluser]SaminOz[/eluser]
I'm just getting back to a site I've ignored for a while. I have a controller that works fine when it passes single value post info to a model for the creation of a new job, but fails when the post values are arrays. I am using active record syntax, and am keen to do so if poss. (code cut down, so as not to annoy).
Code:
Controller code:
$data['job'] = array(
'job_ID' => NULL,
'job_date' => trim($this->input->post('job_date_submit')),
'job_number' => trim($this->input->post('job_number'))
);
Code:
Model code:
function write_new_job($job, $staff_used)
{
$this->db->insert('ww_job', $job);
}
Now I am adding some form elements that are formatted to take multiple values like these two examples below:
Code:
<input type="text" value="00" name="startHr[]" id="startHr" class="background">
<input type="text" value="00" name="startMin[]" id="startMin" class="background">
I got errors with the previous active record insert syntax, so modified it as follows:
Code:
function write_new_job($job, $staff_used)
{
$this->db->insert('ww_job', $job);
$i=0;
for($i=0; $i < count($staff_used); $i++ )
{
$this->db->insert('ww_staff_used', $staff_used[$i]);
}
}
I figured since the errors were "array to string conversion" the issue was that the array values within $staff_used, were not accessible - however this logic does not result in success
Does anyone have experience with this issue and the active record class?