示例#1
0
if (isset($_POST[Salvar])) {
    $obrigatorios[1] = 'nom';
    $obrigatorios[] = 'telefone1';
    $i = $j = 0;
    foreach ($_POST as $post => $valor) {
        $i++;
        if (array_search($post, $obrigatorios) && $valor == "") {
            $r[$i] = '<font color="#FF0000">';
            $j++;
        }
    }
    if ($j == 0) {
        if ($_GET[acao] == "editar") {
            $telefones->LoadTelefones($_GET[codigo]);
        }
        $telefones->SetDados('nome', utf8_decode(htmlspecialchars(utf8_encode($_POST['nom']), ENT_QUOTES | ENT_COMPAT, 'utf-8')));
        $telefones->SetDados('endereco', utf8_decode(htmlspecialchars(utf8_encode($_POST['endereco']), ENT_QUOTES | ENT_COMPAT, 'utf-8')));
        $telefones->SetDados('bairro', utf8_decode(htmlspecialchars(utf8_encode($_POST['bairro']), ENT_QUOTES | ENT_COMPAT, 'utf-8')));
        $telefones->SetDados('cidade', utf8_decode(htmlspecialchars(utf8_encode($_POST['cidade']), ENT_QUOTES | ENT_COMPAT, 'utf-8')));
        $telefones->SetDados('estado', $_POST[estado]);
        $telefones->SetDados('pais', utf8_decode(htmlspecialchars(utf8_encode($_POST['pais']), ENT_QUOTES | ENT_COMPAT, 'utf-8')));
        $telefones->SetDados('cep', $_POST[cep]);
        $telefones->SetDados('celular', $_POST[celular]);
        $telefones->SetDados('telefone1', $_POST[telefone1]);
        $telefones->SetDados('telefone2', $_POST[telefone2]);
        $telefones->SetDados('website', $_POST[website]);
        $telefones->SetDados('email', $_POST[email]);
        if ($_GET[acao] != "editar") {
            $telefones->SalvarNovo();
            //$strScrp = "alert('Cadastro realizado com sucesso!'); Ajax('telefones/incluir', 'conteudo', '');";
        }
示例#2
0
if (isset($_POST[Salvar])) {
    $obrigatorios[1] = 'nom';
    $obrigatorios[] = 'telefone1';
    $i = $j = 0;
    foreach ($_POST as $post => $valor) {
        $i++;
        if (array_search($post, $obrigatorios) && $valor == "") {
            $r[$i] = '<font color="#FF0000">';
            $j++;
        }
    }
    if ($j == 0) {
        if ($_GET[acao] == "editar") {
            $telefones->LoadTelefones($_GET[codigo]);
        }
        $telefones->SetDados('nome', htmlspecialchars($_POST[nom], ENT_QUOTES));
        $telefones->SetDados('endereco', $_POST[endereco]);
        $telefones->SetDados('bairro', $_POST[bairro]);
        $telefones->SetDados('cidade', $_POST[cidade]);
        $telefones->SetDados('estado', $_POST[estado]);
        $telefones->SetDados('pais', $_POST[pais]);
        $telefones->SetDados('cep', $_POST[cep]);
        $telefones->SetDados('celular', $_POST[celular]);
        $telefones->SetDados('telefone1', $_POST[telefone1]);
        $telefones->SetDados('telefone2', $_POST[telefone2]);
        $telefones->SetDados('website', $_POST[website]);
        $telefones->SetDados('email', $_POST[email]);
        if ($_GET[acao] != "editar") {
            $telefones->SalvarNovo();
            //$strScrp = "alert('Cadastro realizado com sucesso!'); Ajax('telefones/incluir', 'conteudo', '');";
        }