Exemplo n.º 1
0
    public function addressFieldValidate()
    {
        $addressFieldValidate = 0;
        if ($this->_countryIso) {
            $addressFieldValidate = 1;
        }
        return $addressFieldValidate;
    }
}
// End AddressController
if (array_key_exists('addAddress', $_POST)) {
    $cAddress = new AddressController((int) $_POST['id'], (int) $_POST['personId'], (int) $_POST['address_type'], $_POST['country_iso'], $_POST['state'], $_POST['street'], $_POST['city'], $_POST['postal_code'], $_POST['note']);
    if ($cAddress->addressFieldValidate()) {
        $model = new AddressPDO();
        if (isset($_GET['action']) && $_GET['action'] === 'create') {
            $model->create($cAddress);
            header("Location: ../profile.php?id=" . $_POST['personId']);
        }
        if (isset($_GET['action']) && $_GET['action'] === 'update') {
            $model->updateById($cAddress);
            header("Location: ../profile.php?id=" . $_POST['personId']);
        }
    } elseif ($_GET['action'] === 'update') {
        header("Location: ../email.php?id={$_POST['personId']}&action=update&validate=error&update={$_POST['id']}");
    } else {
        header("Location: ../email.php?id={$_POST['personId']}&validate=error");
    }
}
if (isset($_GET['action']) && $_GET['action'] == 'delete') {
    $deleteId = (int) $_GET['id'];
    $cAddress = new AddressPDO();