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

Enviar Formulario Pra Outra Pagina


nbr2004

Pergunta

olá pessoal estou com o script pra adicionar e-mail

só que quando você clicar no botao enviar ele abra na mesma pagina, saindo da pagina principal..

to tentando colocar "quando clicar em enviar" ele abrir em window.open, mas não to conseguindo..as informaçoes de Incluir e excluir dá certo..

alguém poderia me ajudar segue abaixo o codigo

Obs ele envia pra mesma pagina o nome dessa pagina é listahpo.php

// Se não executa nada vai para o Formulário

else {
print ("<form method=post action='$PHP_SELF'>
<div align=\"center\">
<center>
<table width=$TableConfig[1] border=$TableConfig[2] bordercolor=$TableConfig[4] cellpadding=$TableConfig[7] cellspacing=$TableConfig[7] bgcolor=$TableConfig[3]>
<tr><tudo width='100%' align='center' valign='middle' bordercolorlight=$TableConfig[5] bordercolordark=$TableConfig[6] style=$TableConfig[9]>
$CabLista</tudo></tr>
<tr><tudo width='100%' align='center' valign='middle' bordercolorlight=$TableConfig[5] bordercolordark=$TableConfig[6] style=$TableConfig[9]>
<b>Nome:</b><BR><input type=\"text\" name=\"ListaNome\" size=$TableConfig[8] style=$StyleCamposAdmin><br>
<b>E-mail:</b><BR><input type=\"text\" name=\"ListaEmail\" size=$TableConfig[8] style=$StyleCamposAdmin><br>
<input type=\"radio\" name=\"Acao\" value=\"incluir\" checked> Incluir <input type=\"radio\" name=\"Acao\" value=\"excluir\"> Excluir<br>
<center><table border='0' cellpadding='0' cellspacing='0'>
<tr><tudo valign='middle' align='left' width='30' height='25'>
<a href=\"#\" onclick=\"window.open('$UrlDaLista/arquivos/incluir.htm','IncluirLista','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,top=30,left=20,width=270,height=370');return false\" onMouseOver=\"self.status='Informações para Incluir seu Email';return true\">
<img border='0' src='$UrlDaLista/arquivos/incluir.gif' alt='Informações para Incluir' width='20' height='20'></a></tudo>
<tudo valign='middle' align='center'>
<input type=\"submit\" value=\" Enviar \" style=$StyleBotaoAdmin></tudo>
<tudo valign='middle' align='right' width='30' height='25'>
<a href=\"#\" onclick=\"window.open('$UrlDaLista/arquivos/excluir.htm','ExcluirLista','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,top=30,left=300,width=270,height=310');return false\" onMouseOver=\"self.status='Informações para Excluir seu Email';return true\">
<img border='0' src='$UrlDaLista/arquivos/excluir.gif' alt='Informações para Excluir' width='20' height='20'></a></tudo>
</tr></table></center>
<font color=red size=1>$erro</font></form></tudo></tr></table></center></div>");

} // Fim do Else - Fim do Script

mysql_close($ConexaoDB);

?>

Link para o comentário
Compartilhar em outros sites

15 respostass a esta questão

Posts Recomendados

  • 0

é só colocar depois de target

ex. geral:

window.open(messageURL,windowNameMessage,[toolbar[=yes|no]|[=1|0],location[=yes|no]|[=1|0],directories[=yes|no]|[=1|0],status[=yes|no]|[=1|0],menubar[=yes|no]|[=1|0],scrollbars[=yes|no]|[=1|0],resizable[=yes|no]|[=1|0],width=pixels,height=pixels])

ficaria assim:

window.open('about:blank','targetname','width=300,height=200');

Link para o comentário
Compartilhar em outros sites

  • 0

eu verifiquei uma coisa e notei que ele não está checando se o e-mail é valido por exemplo se eu colocar

nome Fulano

email Fulano

ele tá cadastrando do mesmo jeito, como eu ponho uma verificação de e-mail??

o script todo está aí em baixo

<?php

require ("config.php");

// Verifica se os campos estão vazios

if($Acao == "incluir" or $Acao == "excluir") {
    $n_erros = 0;
    $erro = "  ";
    if(empty($ListaNome)) {
    $erro.= "ERRO - Digitar o nome<br>";
    $n_erros++;
    }
    if(empty($ListaEmail)) {
    $erro.= "ERRO - Digitar o email<br>";
    $n_erros++;
    }

} // Fecha verificação de campos vazios e existência do email

// Se não há erros, abre o banco de dados, verifica e inclui as informações
// Com envio de emails para o usuário (opcional) e para o Webmaster (não opcional)

if($Acao == "incluir" and $n_erros == "0" or $Acao == "excluir" and $n_erros == "0") {

    if($Acao == "incluir" and $n_erros == "0") {
    $ConsultaIncluir = mysql_query("select email from $TableNome WHERE (email='" . $ListaEmail . "')");
    $ChecaIncluir = mysql_fetch_assoc($ConsultaIncluir);
           if ($ChecaIncluir) { $Conclusao = "Prezado(a) <b>$ListaNome</b><br>Seu Cadastro <b>não foi efetuado</b> porque o email: $ListaEmail <b>já consta</b> em nossa lista<br>Obrigado - $Webmaster";
        imprime_resultado();
        }
        elseif (!$ChecaIncluir and $ConfirmaCadastro == 1) {
        $NovaInfo = "<b>Auto Inclusão via Site - Aguardando Confirmação</b><br>O usuário $ListaNome se cadastrou na Lista<br>Email incluído: $ListaEmail";
        $log = mysql_query("INSERT INTO $TableLog (info, data, hora) VALUES('$NovaInfo','$DataHpo','$HoraHpo')");
        $InfoAtivo = 0;
        $inserir = mysql_query("INSERT INTO $TableNome (nome, email, data, hora, ativo) VALUES('$ListaNome','$ListaEmail','$DataHpo','$HoraHpo','$InfoAtivo')");
            if ($inserir) { $Conclusao = "Prezado(a) <b>$ListaNome</b><br>Seu Cadastro foi registrado com <b>Sucesso</b><br>Email incluído: $ListaEmail<br>Você receberá em momentos um email para confirmar sua inscrição<br>Obrigado - $Webmaster";
                require("$PathDaLista/modelos.php");
                mail("$ListaEmail", "$EmailAssuntoIn", "$MsgConfirmaCadastro", "From: $TituloSite<$EmailSite>");
                mail("$EmailSite", "$EmailAssuntoIn", "$MsgAvisoConfirmaAdm", "From: $TituloSite<$EmailSite>");
                imprime_resultado();
            }
        }
        else {
        $NovaInfo = "<b>Auto Inclusão via Site</b><br>O usuário $ListaNome se cadastrou na Lista<br>Email incluído: $ListaEmail";
        $log = mysql_query("INSERT INTO $TableLog (info, data, hora) VALUES('$NovaInfo','$DataHpo','$HoraHpo')");
        $InfoAtivo = 1;
        $inserir = mysql_query("INSERT INTO $TableNome (nome, email, data, hora, ativo) VALUES('$ListaNome','$ListaEmail','$DataHpo','$HoraHpo','$InfoAtivo')");
            if ($inserir) { $Conclusao = "Prezado(a) <b>$ListaNome</b><br>Seu Cadastro foi efetuado com <b>Sucesso</b><br>Email incluído: $ListaEmail<br>Obrigado - $Webmaster";
                require("$PathDaLista/modelos.php");
                if ($MsgAgradece == '1') {
                mail("$ListaEmail", "$EmailAssuntoIn", "$MensagemAgradeceIn", "From: $TituloSite<$EmailSite>");
                }
                mail("$EmailSite", "$EmailAssuntoIn", "$MensagemAvisoIn", "From: $TituloSite<$EmailSite>");
                imprime_resultado();
            }
        }
    }
    
// Se não há erros, abre o banco de dados, verifica e exclui as informações
// Com envio de emails para o usuário e para o Webmaster

    if($Acao == "excluir" and $n_erros == "0") {
    $ConsultaExcluir = mysql_query("select * from $TableNome WHERE (email='" . $ListaEmail . "')");
    $ChecaExcluir = mysql_fetch_assoc($ConsultaExcluir);
           if ($ChecaExcluir) {
        $NovaInfo = "<b>Auto Remoção via Site</b><br>O usuário $ChecaExcluir[nome] se retirou da Lista<br>Email retirado: $ChecaExcluir[email]";
        $log = mysql_query("INSERT INTO $TableLog (info, data, hora) VALUES('$NovaInfo','$DataHpo','$HoraHpo')");
        $deletar = mysql_query("delete from $TableNome WHERE email='" . $ListaEmail . "'");
            if ($deletar) { $Conclusao = "Prezado(a) <b>$ListaNome</b><br>Seu Cadastro foi excluído com <b>Sucesso</b><br>Email excluído: $ListaEmail<br>Obrigado - $Webmaster";
            require("$PathDaLista/modelos.php");
            mail("$ListaEmail", "$EmailAssuntoOut", "$MensagemAgradeceOut", "From: $TituloSite<$EmailSite>");
            mail("$EmailSite", "$EmailAssuntoOut", "$MensagemAvisoOut", "From: $TituloSite<$EmailSite>");
            imprime_resultado();
            }
        }
        else { $Conclusao = "Prezado(a) <b>$ListaNome</b><br>Seu Cadastro <b>não foi excluído</b> porque o email: $ListaEmail <b>não consta</b> em nossa lista<br>Obrigado - $Webmaster";
          imprime_resultado();
        }
    }
    
} // Fim da inclusão ou exclusão

// Se não executa nada vai para o Formulário

else {
print ("<form method=post action='$PHP_SELF' target='targetname'>
<div align=\"center\">
<center>
<table width=$TableConfig[1] border=$TableConfig[2] bordercolor=$TableConfig[4] cellpadding=$TableConfig[7] cellspacing=$TableConfig[7] bgcolor=$TableConfig[3]>
<tr><tudo width='100%' align='center' valign='middle' bordercolorlight=$TableConfig[5] bordercolordark=$TableConfig[6] style=$TableConfig[9]>
$CabLista</tudo></tr>
<tr><tudo width='100%' align='center' valign='middle' bordercolorlight=$TableConfig[5] bordercolordark=$TableConfig[6] style=$TableConfig[9]>
<b>Nome:</b><BR><input type=\"text\" name=\"ListaNome\" size=$TableConfig[8] style=$StyleCamposAdmin><br>
<b>E-mail:</b><BR><input type=\"text\" name=\"ListaEmail\" size=$TableConfig[8] style=$StyleCamposAdmin><br>
<input type=\"radio\" name=\"Acao\" value=\"incluir\" checked> Incluir <input type=\"radio\" name=\"Acao\" value=\"excluir\"> Excluir<br>
<center><table border='0' cellpadding='0' cellspacing='0'>
<tr><tudo valign='middle' align='left' width='30' height='25'>
<a href=\"#\" onclick=\"window.open('$UrlDaLista/arquivos/incluir.htm','IncluirLista','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,top=30,left=20,width=270,height=370');return false\" onMouseOver=\"self.status='Informações para Incluir seu Email';return true\">
<img border='0' src='$UrlDaLista/arquivos/incluir.gif' alt='Informações para Incluir' width='20' height='20'></a></tudo>
<tudo valign='middle' align='center'>
<input type='submit' value=' Enviar' onclick=\"window.open('about:blank','targetname','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,top=30,left=300,width=270,height=130');\" style=$StyleBotaoAdmin></tudo>
<tudo valign='middle' align='right' width='30' height='25'>
<a href=\"#\" onclick=\"window.open('$UrlDaLista/arquivos/excluir.htm','ExcluirLista','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,top=30,left=300,width=270,height=310');return false\" onMouseOver=\"self.status='Informações para Excluir seu Email';return true\">
<img border='0' src='$UrlDaLista/arquivos/excluir.gif' alt='Informações para Excluir' width='20' height='20'></a></tudo>
</tr></table></center>
<font color=red size=1>$erro</font></form></tudo></tr></table></center></div>");

} // Fim do Else - Fim do Script

mysql_close($ConexaoDB);

?>


Link para o comentário
Compartilhar em outros sites

  • 0

ps: @ em ingles se fala 'at' e significa 'at'.

em portugues se fala 'arroba' (não sei porque) e significa 'por, em...' (bla@hotmail.com = bla em hotmail.com) ;)

======

to tentando :P

tenta assim:

<?php

require ("config.php");

// Verifica se os campos estão vazios

if($Acao == "incluir" or $Acao == "excluir") {
    $n_erros = 0;
    $erro = "  ";
    if(empty($ListaNome)) {
    $erro.= "ERRO - Digitar o nome<br>";
    $n_erros++;
    }
    if(empty($ListaEmail)) {
    $erro.= "ERRO - Digitar o email<br>";
    $n_erros++;
    }
    /***********************/
    // Completely update for match RFC 2822 and RFC 1035
    // http://www.faqs.org/rfcs/rfc2822.html
    // http://www.faqs.org/rfcs/rfc1035.html

    // Example results:
    $example=$ListaEmail;

    $email[] = 'foo@example.com';                      // matched
    $email[] = 'foo.bar@example.co.uk';                // matched
    $email[] = 'foo_bar@example.com';                  // matched
    $email[] = '_foo_bar@example.com';                // matched
    $email[] = 'foo@example.example';                  // matched
    $email[] = '%#a+f.*&654_-._@ee.xx';                // matched
    $email[] = 'foo@abc-123.xx';                      // matched
    $email[] = 'a@a.a.a.a.aa';                        // matched
    $email[] = 'a@a9.aa';                              // matched
    $email[] = 'a!b#c$d%e^f&g*h\'i+j-k{l|m}n_/@op.qr'; //matched

    $email[] = '';                                    //separator

    $email[] = 'foo@-example.com';                    // not matched
    $email[] = 'foo@example-.com';                    // not matched
    $email[] = '%#af.*&@a%#b.xx';                      // not matched
    $email[] = 'a@a.99.00.a.aa';                      // not matched
    $email[] = '_-._@-.--';                            // not matched
    $email[] = 'any..thing@bla.bla';                  // not matched
    $email[] = '@.';                                  // not matched
    $email[] = '@.com';                                // not matched
    $email[] = '@exam@exam.com';                      // not matched
    $email[] = ' @ .com';                              // not matched
    $email[] = '.bar@example.com';                    // not matched
    $email[] = 'foo.@example.com';                    // not matched
    $email[] = 'foo@example.x';                        // not matched

    $atom = '[-a-z0-9!#$%&\'*+/=?^_`{|}~]';    // allowed characters for part before "at" character
    $domain = '([a-z]([-a-z0-9]*[a-z0-9]+)?)'; // allowed characters for part after "at" character

    $regex = '^' . $atom . '+' .        // One or more atom characters.
    '(\.' . $atom . '+)*'.              // Followed by zero or more dot separated sets of one or more atom characters.
    '@'.                                // Followed by an "at" character.
    '(' . $domain . '{1,63}\.)+'.        // Followed by one or max 63 domain characters (dot separated).
    $domain . '{2,63}'.                  // Must be followed by one set consisting a period of two
    '$';                                // or max 63 domain characters.

    foreach ($email as $example) {
      if (strlen($example) == 0):
          echo '';
      else:
        if (eregi($regex, $example)):
        echo '';
        else:
          $n_erros++;
          $erro.="ERRO - O e-mail digitado ($example) é inválido<br>";
        endif;
      endif;
    }
    /***********************/
} // Fecha verificação de campos vazios e existência do email

// Se não há erros, abre o banco de dados, verifica e inclui as informações
// Com envio de emails para o usuário (opcional) e para o Webmaster (não opcional)

if($Acao == "incluir" and $n_erros == "0" or $Acao == "excluir" and $n_erros == "0") {

    if($Acao == "incluir" and $n_erros == "0") {
[........]

Link para o comentário
Compartilhar em outros sites

  • 0

olá coloquei assim

nome. teste

email: teste aí deu a seguinte mensagem

ERRO - O e-mail digitado (foo@-example.com) é inválido

ERRO - O e-mail digitado (foo@example-.com) é inválido

ERRO - O e-mail digitado (%#af.*&@a%#b.xx) é inválido

ERRO - O e-mail digitado (a@a.99.00.a.aa) é inválido

ERRO - O e-mail digitado (_-._@-.--) é inválido

ERRO - O e-mail digitado (any..thing@bla.bla) é inválido

ERRO - O e-mail digitado (@.) é inválido

ERRO - O e-mail digitado (@.com) é inválido

ERRO - O e-mail digitado (@exam@exam.com) é inválido

ERRO - O e-mail digitado ( @ .com) é inválido

ERRO - O e-mail digitado (.bar@example.com) é inválido

ERRO - O e-mail digitado (foo.@example.com) é inválido

ERRO - O e-mail digitado (foo@example.x) é inválido

Link para o comentário
Compartilhar em outros sites

  • 0

isso significa uma coisa: não entendi a sintaxe :P vo tentar entender e posto...

========

já descobri!! :)

sabe aquela sequencia?

$email[] = 'foo@example.com'; // matched

$email[] = 'foo.bar@example.co.uk'; // matched

$email[] = 'foo_bar@example.com'; // matched

$email[] = '_foo_bar@example.com'; // matched

$email[] = 'foo@example.example'; // matched

[...]

tira todas elas e poe:

    $email[]=$ListaEmail;
tenta assim:
    if(empty($ListaEmail)) {
    $erro.= "ERRO - Digitar o email<br>";
    $n_erros++;
    }
    /***********************/
    // Completely update for match RFC 2822 and RFC 1035
    // http://www.faqs.org/rfcs/rfc2822.html
    // http://www.faqs.org/rfcs/rfc1035.html

    // Example results:
    $example=$ListaEmail;

    $atom = '[-a-z0-9!#$%&\'*+/=?^_`{|}~]';    // allowed characters for part before "at" character
    $domain = '([a-z]([-a-z0-9]*[a-z0-9]+)?)'; // allowed characters for part after "at" character

    $regex = '^' . $atom . '+' .        // One or more atom characters.
    '(\.' . $atom . '+)*'.              // Followed by zero or more dot separated sets of one or more atom characters.
    '@'.                                // Followed by an "at" character.
    '(' . $domain . '{1,63}\.)+'.        // Followed by one or max 63 domain characters (dot separated).
    $domain . '{2,63}'.                  // Must be followed by one set consisting a period of two
    '$';                                // or max 63 domain characters.

    foreach ($email as $example) {
      if (strlen($example) == 0):
          echo '';
[......]

testei aqui e valido direitinho :)

Link para o comentário
Compartilhar em outros sites

  • 0

Warning: Invalid argument supplied for foreach() in /home/portalun/public_html/maladireta/listahpo.php on line 36

Prezado(a) teste

Seu Cadastro foi registrado com Sucesso

Email incluído: tes

Você receberá em momentos um email para confirmar sua inscrição

Obrigado - Paulo Henrique R. de Morais

mais facil.. me passa o codigo todo denvo já montado aí eu substituo esse meu

Link para o comentário
Compartilhar em outros sites

  • 0

<?php
$ListaEmail="jose.rob.jr@gasdasdcom";
    /***********************/
    // Completely update for match RFC 2822 and RFC 1035
    // http://www.faqs.org/rfcs/rfc2822.html
    // http://www.faqs.org/rfcs/rfc1035.html

    // Example results:
    $email[]=$ListaEmail;
/*

    $email[] = 'foo@example.com';                      // matched
    $email[] = 'foo.bar@example.co.uk';                // matched
    $email[] = 'foo_bar@example.com';                  // matched
    $email[] = '_foo_bar@example.com';                // matched
    $email[] = 'foo@example.example';                  // matched
    $email[] = '%#a+f.*&654_-._@ee.xx';                // matched
    $email[] = 'foo@abc-123.xx';                      // matched
    $email[] = 'a@a.a.a.a.aa';                        // matched
    $email[] = 'a@a9.aa';                              // matched
    $email[] = 'a!b#c$d%e^f&g*h\'i+j-k{l|m}n_/@op.qr'; //matched

    $email[] = '';                                    //separator

    $email[] = 'foo@-example.com';                    // not matched
    $email[] = 'foo@example-.com';                    // not matched
    $email[] = '%#af.*&@a%#b.xx';                      // not matched
    $email[] = 'a@a.99.00.a.aa';                      // not matched
    $email[] = '_-._@-.--';                            // not matched
    $email[] = 'any..thing@bla.bla';                  // not matched
    $email[] = '@.';                                  // not matched
    $email[] = '@.com';                                // not matched
    $email[] = '@exam@exam.com';                      // not matched
    $email[] = ' @ .com';                              // not matched
    $email[] = '.bar@example.com';                    // not matched
    $email[] = 'foo.@example.com';                    // not matched
    $email[] = 'foo@example.x';                        // not matched
*/
    $atom = '[-a-z0-9!#$%&\'*+/=?^_`{|}~]';    // allowed characters for part before "at" character
    $domain = '([a-z]([-a-z0-9]*[a-z0-9]+)?)'; // allowed characters for part after "at" character

    $regex = '^' . $atom . '+' .        // One or more atom characters.
    '(\.' . $atom . '+)*'.              // Followed by zero or more dot separated sets of one or more atom characters.
    '@'.                                // Followed by an "at" character.
    '(' . $domain . '{1,63}\.)+'.        // Followed by one or max 63 domain characters (dot separated).
    $domain . '{2,63}'.                  // Must be followed by one set consisting a period of two
    '$';                                // or max 63 domain characters.

    foreach ($email as $example) {
      if (strlen($example) == 0):
          echo '';
      else:
        if (eregi($regex, $example)):
        echo '';
        else:
          $n_erros++;
          $erro.="ERRO - O e-mail digitado ($example) é inválido<br>";
        endif;
      endif;
    }
    /***********************/
    echo "Erros ($n_erros):<br>$erro";
    ?>

está ai :)

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...