public function post_originID_custom_state_country_local_handler() { global $FANNIE_OP_DB; $dbc = FannieDB::get($FANNIE_OP_DB); $model = new OriginsModel($dbc); for ($i = 0; $i < count($this->originID); $i++) { $country = isset($this->country[$i]) ? $this->country[$i] : null; $state = isset($this->state[$i]) ? $this->state[$i] : null; $custom = isset($this->custom[$i]) ? $this->custom[$i] : null; if (!$country && !$state && !$custom) { // at least one FK required continue; } $local = isset($this->local[$i]) && $this->local[$i] ? 1 : 0; $model->originID($this->originID[$i]); $model->customID($custom); $model->stateProvID($state); $model->countryID($country); $model->local($local); $model->save(); } $this->normalizeOriginNames(); header('Location: OriginEditor.php'); return false; }