[eluser]tinawina[/eluser]
I am using CI's this->input->post() to work with data posted to a search form. In the form I have a series of checkboxes. In my controller I set up an array containing the checkbox names and I then loop through the post array to determine what to process:
Code:
$checkbox_data = array('subject', 'document_type', 'document_format');
foreach ($checkbox_data AS $value)
{
if ( $this->input->post($value) != '' ) ) // eg., $this->input->post('subject')
{
$data[] = $this->search_lib->process_array_input($value, $this->input->post($value), $this->input->post($value . '_qualifier'));
}
}
This is working except for the fact that I am getting an error notice: "Message: Undefined index: subject"
I am checking for this index before trying to process it. Not sure why I'm getting this error. Also I only get the error for the line that starts with $data[] =.... I don't get it for the check I'm doing in the if statement even though I'm calling $value in the same way as I do to create the $data array.
What needs doing to get rid of this error? Any help is appreciated - thanks!