Skip to content

Instantly share code, notes, and snippets.

@aricore
Created October 30, 2014 12:33
Show Gist options
  • Save aricore/cdc9545d784acae58086 to your computer and use it in GitHub Desktop.
Save aricore/cdc9545d784acae58086 to your computer and use it in GitHub Desktop.
$formValues = $this->input->post(NULL, TRUE);
//Certifications Array
$certifications = array(
'date_of_certification',
'date_certification_expires',
'chef',
'deck',
'diving',
'engineering',
'interior',
'safety',
'specialty',
'other_qualifications_or_certificates',
'certification_verified',
'certification_verification_date',
'certification_verified_by'
);
foreach ($certifications as $key => $value) {
// Remove from save to Crew Table
unset($formValues[$value]);
// Insert into database
// Check if not empty
if (!empty($this->input->post($value) ) ) {
foreach ($this->input->post($value) as $key_post => $value_post) {
if (!empty($value_post)) {
$data_insert_certifications[$value] = $value_post;
}
}
}
}
// Insert into Database if not empty
if (!empty($data_insert_certifications)) {
$data_insert_certifications['user_id'] = $user_id;
$this->db->insert('certifications', $data_insert_certifications);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment