joaorosa Posted April 1, 2007 at 01:20 AM Report Share #91073 Posted April 1, 2007 at 01:20 AM boas malta. estou-me a iniciar no php. tenho um pqeueno form, onde se o mail for enviado dá uma mensagem... mas eu quero que a mensagem apareça dentro de um div. qual é o código que ponho no echo? cps Link to comment Share on other sites More sharing options...
djthyrax Posted April 1, 2007 at 02:01 AM Report Share #91080 Posted April 1, 2007 at 02:01 AM podes mostrar o teu código actual? era mais fácil para ti de perceberes 👍 Não peças ajuda por PM! A tua dúvida vai ter menos atenção do que se for postada na secção correcta do fórum! Link to comment Share on other sites More sharing options...
joaorosa Posted April 1, 2007 at 12:12 PM Author Report Share #91108 Posted April 1, 2007 at 12:12 PM <?php if(!empty($_POST['Submit'])) { $to = "xxx@xxx.com"; $name = $_POST["nome"]; $adress = $_POST["morada"]; $tlf = $_POST["telefone"]; $tlm = $_POST["telemovel"]; $fax = $_POST["fax"]; $email1 = $_POST["email1"]; $subject = $_POST["assunto"]; $message = $_POST["pedido"]; $email2 = $_POST["email2"]; if(empty($name) || empty($subject)) { echo "Preencha os campos correctamente"; } else { $headers = "From: ".$name." [".$email1."]\r\nReply-To: ".$email1."\r\nReturn-Path: ".$email1."\r\n"; $smessage = "Nome: ".$name."\nMorada: ".$adress."\nTelefone: ".$tlf."\nTelemóvel: ".$tlm."\nFax: ".$fax."\nEmail: ".$email1."\n\nAssunto: ".$subject."\nMensagem: \n\n".$message."\n\nEmail de resposta: ".$email2."\r\n"; $mailsent = mail($to, $subject, $smessage, $headers); if($mailsent) { echo "A sua mensagem foi enviada com sucesso.<br>Obrigado."; } else { echo "Ocorreu um erro ao enviar a sua mensagem. Tente novamente!<br>"; } } } ?> </head> </body> <div id="msg"></div> cps Link to comment Share on other sites More sharing options...
djthyrax Posted April 1, 2007 at 02:57 PM Report Share #91137 Posted April 1, 2007 at 02:57 PM <?php if(!empty($_POST['Submit'])) { $to = "xxx@xxx.com"; $name = $_POST["nome"]; $adress = $_POST["morada"]; $tlf = $_POST["telefone"]; $tlm = $_POST["telemovel"]; $fax = $_POST["fax"]; $email1 = $_POST["email1"]; $subject = $_POST["assunto"]; $message = $_POST["pedido"]; $email2 = $_POST["email2"]; if(empty($name) || empty($subject)) { $dados = "Preencha os campos correctamente"; } else { $headers = "From: ".$name." [".$email1."]\r\nReply-To: ".$email1."\r\nReturn-Path: ".$email1."\r\n"; $smessage = "Nome: ".$name."\nMorada: ".$adress."\nTelefone: ".$tlf."\nTelemóvel: ".$tlm."\nFax: ".$fax."\nEmail: ".$email1."\n\nAssunto: ".$subject."\nMensagem: \n\n".$message."\n\nEmail de resposta: ".$email2."\r\n"; $mailsent = mail($to, $subject, $smessage, $headers); if($mailsent) { $dados = "A sua mensagem foi enviada com sucesso.<br>Obrigado."; } else { $dados = "Ocorreu um erro ao enviar a sua mensagem. Tente novamente!<br>"; } } } ?> </head> </body> <div id="msg"><?php echo $dados; ?></div> Não peças ajuda por PM! A tua dúvida vai ter menos atenção do que se for postada na secção correcta do fórum! Link to comment Share on other sites More sharing options...
joaorosa Posted April 1, 2007 at 03:29 PM Author Report Share #91142 Posted April 1, 2007 at 03:29 PM obrigado. e já agora, como é que posso fazer a verificação de uma variável, se é composta só por números? no javascript existe o isNaN(), mas não sei qual é o método em php. Link to comment Share on other sites More sharing options...
karva Posted April 1, 2007 at 03:41 PM Report Share #91145 Posted April 1, 2007 at 03:41 PM http://pt2.php.net/is_numeric Proud LEIC-A@IST student! Link to comment Share on other sites More sharing options...
joaorosa Posted April 1, 2007 at 04:37 PM Author Report Share #91149 Posted April 1, 2007 at 04:37 PM muito obrigado malta! cps Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now