} else { //if the item was changed successfully, add to array $changes[] = "<strong>" . $value . "</strong> was not updated successfully."; $changes[] = $database->last_error; } } } } //now we're done with all updates //check to see if we need to create a new vaccination record //only if it's not blank if (!empty($_POST['new_vaccination'])) { $new_vaccination = new Vaccination(); $new_vaccination->vaccination_name = $_POST['new_vaccination']; //try to save if ($new_vaccination->save()) { $changes[] = "<strong>" . $new_vaccination->vaccination_name . "</strong> was created successfully."; } else { $changes[] = "<strong>" . $new_vaccination->vaccination_name . "</strong> was not created successfully."; $changes[] = $database->last_error; } } //at this point, we're done with all changes //check to see if there are any changes, if so, make them into messages if (count($changes) != 0) { $session->message(implode("<br />", $changes)); } //lastly, redirect back to itself redirect_head(current_url()); } //header template