Ir para conteúdo
Fórum Script Brasil
  • 0

(Resolvido) Script de alert


jatobas

Pergunta

Meu scrapit

function alert1(){
    Excluir = confirm("Deseja realmente apagar ?")//a variavel Excluir aguarda um comando ok ou cancelar retornando assim false ou true
    if ( Excluir ==false){// testa se o usuario clicou em cancelar
    alert("Cancelando")

    }
    if ( Excluir ==true){// testa se o usuario clicou em ok
    alert("Apagando")
    location.href = "../alterarFormularioNome.php" 
    }
}
TODO O CODIGO
<?php
require_once('../control/PessoaJuridicaControl.php');
$pes_nome = $_POST['PES_NOME_FANT'];
$pessoaJuridicaDao = new PessoaJuridicaDao();

$dados = $pessoaJuridicaDao->buscarDadosNome($pes_nome);
if(!$dados){
    echo "
        &lt;script>alert('Usuario não encontrado.');</script>
        <meta HTTP-EQUIV='refresh' CONTENT='0;URL=../alterarFormularioPJAdmin.php'>
    ";
}else{
    //header("location:../"."alterarFormularioNome.php");
}
?>
<html>

  <head>

    <title>Abla</title>

      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

      <link href="../estilo.css" type="text/css" rel="stylesheet" />
      &lt;script type="text/javascript">
      
           

    function alert1(){
    Excluir = confirm("Deseja realmente apagar ?")//a variavel Excluir aguarda um comando ok ou cancelar retornando assim false ou true
    if ( Excluir ==false){// testa se o usuario clicou em cancelar
    alert("Cancelando")

    }
    if ( Excluir ==true){// testa se o usuario clicou em ok
    alert("Apagando")
    location.href = "../alterarFormularioNome.php" 
    }
}



}


            
        
      </script>
  </head>
  <body>
        <div id="cont" class="cent" align="center">  
            <ul id="dropmenu">
            <li class="current_page_item"><a href="admin.php">&nbsp;Privado&nbsp;</a></li>
            <li class="page_item page-item-2"><a href="../adminPerfil.php">Perfil do Associado</a>
            <li class="page_item page-item-2"><a href="../adminLocadoras.php">&nbsp;Locadoras&nbsp;</a>
            <li class="page_item page-item-2"><a href="../formularioVeiculos.php">&nbsp;Veículos&nbsp;</a>
            <li class="page_item page-item-2"><a href="../administracao.php">Relatórios&nbsp;</a>
            <li class="page_item page-item-2"><a href="http://www.abla.com.br/">Sair</a>
            </ul>
            
            <div id="conteudo">
            <img class="cent" align="center" style="margin-top: 100px;" src='../img/logo-ABLA-cinza.jpg' /><br/><br/><br/>
            </div>    
        </div>
        <div id="tabela" style="margin-top: 50px;">
<div id="id" align="center" style="color:#666;">
            <table style="width:590px;border-width: 1px;border-style: solid;bordercolor:#DCDCDC;margin-top:0px;"cellspacing="0" cellpadding="0">
                  <tr>
                    <th align="center" style="width:350px;border-width: 1px;border-style: solid;border-color:#DCDCDC;" >Cliente</th>
                    <th align="center" style="width:118px;border-width: 1px;border-style: solid;border-color:#DCDCDC;" >Atualizar</th>
                    <th align="center" style="width:118px;border-width: 1px;border-style: solid;border-color:#DCDCDC;" >Remover</th>
                  <tr>
            </table>    
        </div>                    
        <?php
            require_once('../dao/PessoaJuridicaDao.php');
    
                    
            $PessoaJuridicaDao=new PessoaJuridicaDao();
            $objPessoaJuridca = $PessoaJuridicaDao->buscarDadosNome($pes_nome);
            while($linha = mysql_fetch_array($objPessoaJuridca)){
                
                ?>
            
                <div id="id" align="center">
                <table style="width:590px;border-width: 1px;border-style: solid;border-color:#DCDCDC;"cellspacing="0" cellpadding="0">
                      <tr>
                    <th  align="left" style="width:350px;color:#666;" ><?php    echo $linha['PES_NOME_FANT']?></th>
                    <th align="center" style="width:105;border-width: 1px;border-style: solid;border-color:#DCDCDC;" >
                        <form method="post" action="../alterarFormularioNome.php?PES_CNPJ=<?php echo $linha['PES_CNPJ']?>&PES_NOME_FANT=<?php echo $linha['PES_NOME_FANT']?>
                        &PES_RAZAO_SOC=<?php echo $linha['PES_RAZAO_SOC']?>
                        &PES_INSC_EST=<?php echo $linha['PES_INSC_EST']?>
                        &PES_INSC_MUN=<?php echo $linha['PES_INSC_MUN']?>
                        &PES_DATA_FUND=<?php echo $linha['PES_DATA_FUND']?>
                        &PES_CONTATO=<?php echo $linha['PES_CONTATO']?>
                        &PES_TEL1=<?php echo $linha['PES_TEL1']?>
                        &PES_TEL2=<?php echo $linha['PES_TEL2']?>
                        &PES_FAX=<?php echo $linha['PES_FAX']?>
                        &PES_CEL1=<?php echo $linha['PES_CEL1']?>
                        &PES_CEL2=<?php echo $linha['PES_CEL2']?>
                        &PES_EMAIL1=<?php echo $linha['PES_EMAIL1']?>
                        &PES_SITE=<?php echo $linha['PES_SITE']?>
                        &PES_ID_STATUS=<?php echo $linha['PES_ID_STATUS']?>
                        &PES_ANOS_SETOR=<?php echo $linha['PES_ANOS_SETOR']?>
                        &PES_ANO_FILIACAO_ABLA=<?php echo $linha['PES_ANO_FILIACAO_ABLA']?>
                        &PES_ANO_FILIACAO_SINDLOC=<?php echo $linha['PES_ANO_FILIACAO_SINDLOC']?>
                         "  >                                
                            <input name="opcao" type="image" value="Alterar" src="img/alterar.png" /></th>
                        </form>
                    <th>             
                        <form method="post" action="buscarDadosPJNome.php?opcao=Excluir&PES_CNPJ=<?php echo $linha['PES_CNPJ']?>">
                            <input name="opcao" type="image" value="Excluir" src="img/remover.png" onClick='return alert1()'>
                        </form>   
                    </th> 
            <?php } ?>    
                </table>
                </div>
                <?php    
                    @$opcao=$_POST['opcao'];                        
                    if($opcao=="Excluir")
                    {
                        @$pesCnpj=$_GET['PES_CNPJ'];
                        $query=$PessoaJuridicaDao->remover($pesCnpj);
                        
                    }                    
                ?>
  <body>
</html>

Link para o comentário
Compartilhar em outros sites

3 respostass a esta questão

Posts Recomendados

  • 0

vlw pela ajuda ..

Resolvido, fiz da seguinte forma ..

function alert1(){
    if (confirm("Deseja realmente excluir este registro?")){
       location.href = "../alterarFormularioNome.php" 
    }
    else{
        return false
    }
    
    }

Link para o comentário
Compartilhar em outros sites

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152,1k
    • Posts
      651,8k
×
×
  • Criar Novo...