Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Galera seguinte,
Tenho uma página com um formulário de e-mail. EStá funcionando na boa, só que eu preciso que o script fique na mesma página do form. Até aí tudo bem consegui fazer, só que eu preciso fazer uma condição pra que o scritp naum fique rodando direto, tipo ele so pode ser executado dpois q usuário clicar em enviar.
segue o código
<?php$nome = $_POST['txt_nome'];$email = $_POST['txt_email'];$telefone = $_POST['txt_telefone'];$recado = $_POST['txt_mensagem'];$msg = "<html><head><title>Dughetu - Site Oficial » Novo Contato</title></head><body><table width='500' border='0' align='center' cellpadding='0' cellspacing='0'> <tr> <td width='20'></td> <td width='460'> <p></p> <p><img src='http://www.dughettu.com.br/2006/contato/images/logotipo_dughettu_mail.gif' /></p> <p style='font-family: Georgia, Times New Roman, Times, serif; font-size: 11px; color: #4d4d4d; line-height: 18px;'><strong>Existe um novo contato para a Dughettu !</strong></p> <p style='font-family: Georgia, Times New Roman, Times, serif font-size: 11px; color: #4d4d4d; line-height: 18px;'><strong>Nome: </strong>".$nome."<br /><strong>E-mail: </strong>".$email."<br /><strong>Telefone: </strong>".$telefone."</p> <p style='font-family: Georgia, Times New Roman, Times, serif; font-size: 11px; color: #4d4d4d; line-height: 12px;'>".$recado."</p> <p style='font-family: Georgia, Times New Roman, Times, serif; font-size: 11px; color: #4d4d4d; line-height: 18px;'><strong>Dughettu - Site Oficial </strong><br /> <span style='font-family: Georgia, Times New Roman, Times, serif; font-size: 10px; color: #4d4d4d; line-height: 14px;'><a style='color:#4d4d4d; text-decoration: none;' href='[http://www.azeitonapreta.com'](http://www.azeitonapreta.com) target='_blank'>www.dughettu.com</a>.br<br /> <a style='color:#4d4d4d; text-decoration: none;' href='mailto:produghettu@dughettu.com.br'>produghettu@dughettu.com.br</a></span></p> <p class='style1'> </p></td> <td width='20'></td> </tr></table></body></html>";$mensagem = "$msg";$remetente = "$email";$destinatario = "produghettu@dughettu.com.br";$assunto = "Dughettu - Site Oficial » Novo Contato";$headers = "MIME-Version: 1.0\r\n";$headers .= "Content-type: text/html; charset=utf-8\r\n";$headers .= "From: $remetente\r\n";$headers .= "Bcc: leandro@dughettu.com.br\r\n";if(!mail($destinatario,$assunto,$mensagem,$headers)){print "falha no envio da mensagem";} else { echo "<script typef='text/javascript'> <!-- alert('Mensagem enviada com sucesso! Breve entraremos em contato.'); window.location.href = 'subnav.php'; //--> </script>";}?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "[http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">](http://www.w3.org/1999/xhtml) <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Dughettu</title> </head> <body> <div id="subnav"> <ul> <!--<li><a href="javascript:ajaxpage('agenda/2006.php', 'conteudo');">2006</a></li>--> </ul> </div> <div id="conteudo"> <h1 id="h1_contato">Contato</h1> <h2>Contato</h2> <form action="contato/envia_contato.php" method="post" name="form_contato" id="form_contato"> <fieldset> <legend>Mande seu recado!</legend> <label for="nome">Nome:</label> <input name="txt_nome" type="text" id="txt_nome" /> <label for="email">Email:</label> <input name="txt_email" type="text" id="txt_email" /> <label for="telefone">Telefone:</label> <input name="txt_telefone" type="text" id="txt_telefone" /> <p>(00) 0000-0000</p> <textarea name="txt_mensagem" rows="5" wrap="virtual" id="txt_mensagem"></textarea> <input name="btn_enviar" type="submit" id="btn_enviar" value="Enviar" /> </fieldset> </form> </div> </body></html>Carregando comentários...