Ir ao conteúdo
  • Cadastre-se

Ajuda na criação de formulário Dreamweaver CS5


augustoscj

Posts recomendados

Olá amigos...

to seguindo os passos desse site :

-

http://www.ajaxme.com/gratis/videoaulas/curso-gratis/curso-de-dreamweaver

-

porém, o video 'formulário' não está completo, e eu fiz meio "a olho" e parti pro próximo passo que era a validação e capturando post...

encontrei um problema em capturando o post...

sigo todos os passos certinho... salvo a pág em php (era html), faço os códigos que ele pede, mas acontece isso na hora de testar a pág:

-

http://images.orkut.com/orkut/photos/OgAAADONwiqG7-t-f8VLAp4ajVK9_-IcaRfroTfYgNyWnHNR7x3RSbbsWGYTFhmRTRx9Xg6PEJXl95yBwD-usD10mSgAm1T1UHGWXbtPVEuP3uYa47zut1p66h29.jpg

-

o código que fiz seguindo os passos do video, é esse:

-

http://images.orkut.com/orkut/photos/OgAAAMDEr-vkS5Ep0nmLMiJqyF8rFDFDPwcScRZGu5X-ZlY-c6KbYKf9dCWX5vi4zHELuMEAOCS3BOh6nmVjWXPBlLQAm1T1UKV2CFZlsx9GbinGus9CgK7komd1.jpg

-

aguardo uma ajuda, de onde pode estar vindo esse erro!

obrigado!

Link para o comentário
Compartilhar em outros sites

  • Moderador

as variaveis estão indefinidas.

tenha certeza que no formulario você esta enviando os "names" certos

por exemplo se você tiver:

<input type="text" name="email"/>

no php você deve resgatar por post assim:

$email = $_POST["email"];

e no formulario você deve colocar o faleconosco.php dentro de action=" "

exemplo:

formulario HTML:


<form method="post" action="faleconosco.php">
nome: <input type="text" name="nome"/><br/>
email: <input type="text" name="email"/><br/>
Comentarios: <textarea cols="5" rows="40" name="comentarios"> </textarea><br/>

<input type="submit" value="enviar"/>

</form>

faleconosco.php:


$nome = $_POST["nome"];
$email = $_POST["email"];
$comentario = $_POST["comentarios"];

//verifica campos em branco
if(empty($nome) or empty($email) or empty($comentario)){
echo " <script>
alert('Todos os campos devem ser preenchidos');
history.go(-1);
</script> ";
exit;
}

....
aqui vai o resto do codigo por exemplo enviar para o email com a classe phpmailer..

Link para o comentário
Compartilhar em outros sites

to me complicando aqui, pois sou novo na area amigo..

vou postar o código, e se você puder me ajudar, fico muito grato!

<?php 
$enviado = $_POST ['enviado'];
$nome = $_POST ['txtnome'];
$email = $_POST ['txtemail'];
$msg = $_POST ['txtmsg'];
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="description" content="Your description goes here" />
<meta name="keywords" content="your,keywords,goes,here" />
<meta name="author" content="Your Name" />
<link rel="stylesheet" type="text/css" href="andreas00.css" media="screen,projection" />
<title>::. Alpha Gás - Convertedora GNV .::</title>
<style type="text/css">
body {
background-image: url(img/fundo_meio.jpg);
background-repeat: repeat-x;
}
</style>
<link href="img/css.css" rel="stylesheet" type="text/css" />
<script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<script src="SpryAssets/SpryValidationTextarea.js" type="text/javascript"></script>
<link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
<link href="SpryAssets/SpryValidationTextarea.css" rel="stylesheet" type="text/css" />
</head>

<body background="img/fundo_meio.jpg">
<div id="wrap">
<div id="header"><img src="img/1.jpg" alt="" width="847" height="275" /> </div>

<div id="leftside">
<h2 class="hide">Sample menu:</h2>
<ul class="avmenu">
<li><a class="current" href="index.html"> Página Inicial</a></li>
<li><a href="produtos.html">Produtos</a></li>
<li></li>
<li><br />
</li>
</ul>
<ul class="avmenu">
<li></li>
<li><a href="servicos.html">Serviços</a><a href="gnv.html">GNV<br />
</a></li>
<li></li>
<li> <a href="faleconosco.php">Fale Conosco</a></li>
<li><br />
</li>
</ul>
<p> </p>
<div class="announce">
<h2>Sample news:</h2>
<p><strong>Apr 24, 2008:</strong><br />
Updated to v2.2 minor fixes and adjustments.</p>
<p>This template includes a lot of additional styles and layout variations in the stylesheet. To see these, use the navigation menu to view the different pages and layout examples.</p>
<p class="textright"><a href="#">Sample link »</a></p>
</div>
</div>

<div id="extras">
<h2><br />
<br />
<br />
</h2>
<p>If you want to support the development of more free templates, it is possible to make a <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=paypal%40andreasviklund%2ecom&item_name=Donations%20for%20andreasviklund%2ecom&item_number=2007&no_shipping=0&cn=Comments%20%28optional%29&tax=0&currency_code=USD&lc=SE&bn=PP%2dDonationsBF&charset=UTF%2d8">donation</a> of any amount through PayPal. All donations are used to develop new templates and to keep the template site online. Top donors will get their name and link listed on the site (if wanted). Advertising options are also available. Contact me for more information!</p>

<h2>Sample links:</h2>
<ul>
<li><a href="http://andreasviklund.com/templates/">Free website templates</a></li>
<li><a href="http://andreasviklund.com/templates/commercial/">Commercial templates</a></li>
<li><a href="http://andreasviklund.com/wordpress-themes/">WordPress themes</a></li>
</ul>

<h2>Sample search:</h2>
<form action="get" id="searchbox">
<div>
<label for="searchform">Find:</label> <input type="text" value="(demo only)" name="searchform" id="searchform" /> <input type="hidden" id="searchsubmit" value="(demo only)" />
</div>
</form>

<h2>Version:</h2>
<p>andreas00 v2.2<br />
(Apr 24, 2008)</p>
</div>

<div id="content">
<h2 align="center"> <span class="titulo">.: Fale Conosco:.</span></h2>
<div>
<div align="center">
<form id="form1" method="post" action="faleconosco.php">
<table width="97%" height="355" border="0">
<tr>
<td width="31%"> </td>
<td width="69%"><label for="txtnome">
<?php if ($enviado==1){ ?>
</label>
<h3>Mensagem Enviada.</h3>
<?php }?></td>
</tr>
<tr>
<td>Nome:</td>
<td><label for="txtnome"></label>
<span id="sprytextfield1">
<input type="text" name="txtnome" id="txtnome" />
<span class="textfieldRequiredMsg">Campo Obrigatório.</span></span></td>
</tr>
<tr>
<td>Email:</td>
<td><label for="txtemail"></label>
<span id="sprytextfield2">
<input type="text" name="txtemail" id="txtemail" />
<span class="textfieldRequiredMsg">Campo Obrigatório.</span><span class="textfieldInvalidFormatMsg">Email inválido.</span></span></td>
</tr>
<tr>
<td height="121">Mensagem:</td>
<td><label for="txtmsg"></label>
<span id="sprytextarea1">
<textarea name="txtmsg" id="txtmsg" cols="45" rows="5"></textarea>
<span class="textareaRequiredMsg">Campo Obrigatório.</span><span class="textareaMinCharsMsg">Número mínimo de caracteres não atendido.</span><span class="textareaMaxCharsMsg">Número máximo de caracteres excedido.</span></span></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="button" id="button" value="Enviar" />
<input name="enviado" type="hidden" id="enviado" value="1" /></td>
</tr>
</table>
<p> </p>
</form>
<p> </p>
<table width="150" border="0">
<tr>
<td width="23%">Nome:</td>
<td width="77%">##nome</td>
</tr>
<tr>
<td>Email:</td>
<td>##email</td>
</tr>
<tr>
<td>Mensagem:</td>
<td> </td>
</tr>
<tr>
<td> </td>
<td>##mensagem</td>
</tr>
</table>
<p> </p>
<p> </p>
</div>
</div>
</div>

<div id="footer">
<p><span>© 2011 Alpha Gás</span><br />
<a href="http://andreasviklund.com/templates/" title="Original CSS template design">Original design</a> by - <a href="http://andreasviklund.com/" title="Andreas Viklund">Pluma - Informática e Marketing</a></p></div></div>
<script type="text/javascript">
var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1", "none", {validateOn:["blur"]});
var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2", "email", {validateOn:["blur"]});
var sprytextarea1 = new Spry.Widget.ValidationTextarea("sprytextarea1", {validateOn:["blur"], minChars:1, maxChars:10000});
</script>
</body>
</html>

obrigado!

abraço

Link para o comentário
Compartilhar em outros sites

estou com dificuldades pra fazer isso funcionar amigo..

fiz o que você me disse...(tentei pelo menos) e deu nisso:

fiz o seguinte: criei o Html e nele tem o form.



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="description" content="Your description goes here" />
<meta name="keywords" content="your,keywords,goes,here" />
<meta name="author" content="Your Name" />
<link rel="stylesheet" type="text/css" href="andreas00.css" media="screen,projection" />
<title>::. Alpha Gás - Convertedora GNV .::</title>
<style type="text/css">
body {
background-image: url(img/fundo_meio.jpg);
background-repeat: repeat-x;
}
</style>
<link href="img/css.css" rel="stylesheet" type="text/css" />
<script src="Scripts/swfobject_modified.js" type="text/javascript"></script>
</head>

<body background="img/fundo_meio.jpg">
<div id="wrap">
<div id="header">
<object id="FlashID" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="850" height="275">
<param name="movie" value="img/Usado.swf" />
<param name="quality" value="high" />
<param name="wmode" value="opaque" />
<param name="swfversion" value="6.0.65.0" />
<!-- Esta tag param solicita que os usuários com o Flash Player 6.0 r65 e versões posteriores baixem a versão mais recente do Flash Player. Exclua-o se você não deseja que os usuários vejam o prompt. -->
<param name="expressinstall" value="Scripts/expressInstall.swf" />
<!-- A tag object a seguir aplica-se a navegadores que não sejam o IE. Portanto, oculte-a do IE usando o IECC. -->
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="img/Usado.swf" width="850" height="275">
<!--<![endif]-->
<param name="quality" value="high" />
<param name="wmode" value="opaque" />
<param name="swfversion" value="6.0.65.0" />
<param name="expressinstall" value="Scripts/expressInstall.swf" />
<!-- O navegador exibe o seguinte conteúdo alternativo para usuários que tenham o Flash Player 6.0 e versões anteriores. -->
<div>
<h4>O conteúdo desta página requer uma versão mais recente do Adobe Flash Player.</h4>
<p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Obter Adobe Flash player" width="112" height="33" /></a></p>
</div>
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object>
</div>

<div id="leftside">
<h2 class="hide">Sample menu:</h2>
<ul class="avmenu">
<li><a class="current" href="index.html"> Página Inicial</a></li>
<li><a href="produtos.html">Produtos</a></li>
<li></li>
<li><br />
</li>
</ul>
<ul class="avmenu">
<li></li>
<li><a href="servicos.html">Serviços</a><a href="gnv.html">GNV<br />
</a></li>
<li></li>
<li> <a href="/alpha/faleconosco.php">Fale Conosco</a></li>
<li><br />
</li>
</ul>
<p> </p>
<div class="announce">
<h2>Uma Noticia:</h2>
<p><strong>Apr 24, 2008:</strong><br />
Updated to v2.2 minor fixes and adjustments.</p>
<p>This template includes a lot of additional styles and layout variations in the stylesheet. To see these, use the navigation menu to view the different pages and layout examples.</p>
<p class="textright"> </p>
</div>
</div>

<div id="extras">
<h2><br />
<br />
<br />
</h2>
<p>If you want to support the development of more free templates, it is possible to make a <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=paypal%40andreasviklund%2ecom&item_name=Donations%20for%20andreasviklund%2ecom&item_number=2007&no_shipping=0&cn=Comments%20%28optional%29&tax=0&currency_code=USD&lc=SE&bn=PP%2dDonationsBF&charset=UTF%2d8">donation</a> of any amount through PayPal. All donations are used to develop new templates and to keep the template site online. Top donors will get their name and link listed on the site (if wanted). Advertising options are also available. Contact me for more information!</p>

<h2>Sample links:</h2>
<ul>
<li><a href="http://andreasviklund.com/templates/">Free website templates</a></li>
<li><a href="http://andreasviklund.com/templates/commercial/">Commercial templates</a></li>
<li><a href="http://andreasviklund.com/wordpress-themes/">WordPress themes</a></li>
</ul>

<h2> </h2>
</div>

<div id="content">
<h2 align="center"> <span class="titulo">.: Viabilidade do uso do GNV :.</span></h2>
<table width="98%" height="339" border="0" align="center">
<tr>
<td><p><img src="img/rodagnv.jpg" alt="" width="446" height="307" />Um Carro que roda 10km/l de gasolina, faz em média 7km/l de álcool e 13km/m³ de GNV.<br />
Preço dos combustíveis em SP:
gasolina R$ 3,00/l ; etanol R$ 2,20/l ;<br />
GNV R$ 1,33</p></td>
</tr>
</table>
<h2 align="center"> <span class="titulo">.: Pense verde, rode GNV :.</span><img src="img/pense-verde.gif" alt="" width="278" height="140" align="left" /><br />
</h2>
<p>GNV Preserva o meio ambiente, GNV Preservo O SEU BOLSO !</p>
<p> </p>
<p> </p>
<p><a href="http://andreasviklund.com/templates/">andreas01</a> template to which andreas00 added requested features such as a 2-column layout variation and support for sub-pages in the main menu - features that were later added into andreas01 as well. But there are also other small modifications and a few extras, like the background images in the menu buttons and table styles. I hope that you like what you see and that you find the template to be easy to work with. That is what it was made for!</p>
<img src="img/test.jpg" height="100" width="125" class="left" alt="Example content image" />
<p>I kindly ask that you leave the credit text and link (the one that says "Design by Andreas Viklund" in the footer) since that is a nice way of supporting my template design work. But it is no requirement, just a request. Do what works best for you!</p>

<h3>CMS templates and blog themes?</h3>
<p>This template is has been converted into a <a href="http://andreasviklund.com/wordpress-themes/" title="WP-Andreas00 theme for WordPress">theme for WordPress</a> and for a number of other content management systems and blog engines as well. If you are planning to use this template with a CMS or a blog script, it may be worth checking if the template has been ported to the system of your choice already. Links to these variations can be found on the original <a href="http://andreasviklund.com/templates/">templates site</a>. Good luck with your new site design!</p>
</div>

<div id="footer">
<p><span>© 2011 Alpha Gás</span><br />
<a href="http://andreasviklund.com/templates/" title="Original CSS template design">Original design</a> by - <a href="http://andreasviklund.com/" title="Andreas Viklund">Pluma - Informática e Marketing</a></p></div></div>
<script type="text/javascript">
swfobject.registerObject("FlashID");
</script>
</body>
</html>

ali se encontra o form. que você me falou pra fazer...

e fiz esse em php o 'faleconosco'... mas não funciona:


<?php
$nome = $_POST["nome"];
$email = $_POST["email"];
$comentario = $_POST["comentarios"];

//verifica campos em branco
if(empty($nome) or empty($email) or empty($comentario)){
echo " <script>
alert('Todos os campos devem ser preenchidos');
history.go(-1);
</script> ";
exit;
}

?>

queria saber onde estou errando..

obrigado

Link para o comentário
Compartilhar em outros sites

realmente passei o arquivo errado, me desculpe!

mas consegui resolver com a ajuda de um rapaz do orkut, e deu certo!

segue o código que ele me ajudou (desde o inicio, até o fim do formulário, não até o fim da página) ..



<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$enviado = $_POST ['enviado'];
$nome = $_POST ['txtnome'];
$email = $_POST ['txtemail'];
$msg = $_POST ['txtmsg'];
echo ('<script>alert(\'Mensagem Enviada.\')</script>');

}
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="description" content="Your description goes here" />
<meta name="keywords" content="your,keywords,goes,here" />
<meta name="author" content="Your Name" />
<link rel="stylesheet" type="text/css" href="andreas00.css" media="screen,projection" />
<title>::. Alpha Gás - Convertedora GNV .::</title>
<style type="text/css">
body {
background-image: url(img/fundo_meio.jpg);
background-repeat: repeat-x;
}
</style>
<link href="img/css.css" rel="stylesheet" type="text/css" />
<script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<script src="SpryAssets/SpryValidationTextarea.js" type="text/javascript"></script>
<link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
<link href="SpryAssets/SpryValidationTextarea.css" rel="stylesheet" type="text/css" />
</head>

<body background="img/fundo_meio.jpg">
<div id="wrap">
<div id="header"><img src="img/1.jpg" alt="" width="847" height="275" /> </div>
<div id="leftside">
<h2 class="hide">Sample menu:</h2>
<ul class="avmenu">
<li><a class="current" href="index.html"> Página Inicial</a></li>
<li><a href="produtos.html">Produtos</a></li>
<li></li>
<li><br />
</li>
</ul>
<ul class="avmenu">
<li></li>
<li><a href="servicos.html">Serviços</a><a href="gnv.html">GNV<br />
</a></li>
<li></li>
<li> <a href="faleconosco.php">Fale Conosco</a></li>
<li><br />
</li>
</ul>
<p> </p>
<div class="announce">
<h2>Sample news:</h2>
<p><strong>Apr 24, 2008:</strong><br />
Updated to v2.2 minor fixes and adjustments.</p>
<p>This template includes a lot of additional styles and layout variations in the stylesheet. To see these, use the navigation menu to view the different pages and layout examples.</p>
<p class="textright"><a href="#">Sample link »</a></p>
</div>
</div>
<div id="extras">
<h2><br />
<br />
<br />
</h2>
<p>If you want to support the development of more free templates, it is possible to make a <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=paypal%40andreasviklund%2ecom&item_name=Donations%20for%20andreasviklund%2ecom&item_number=2007&no_shipping=0&cn=Comments%20%28optional%29&tax=0&currency_code=USD&lc=SE&bn=PP%2dDonationsBF&charset=UTF%2d8">donation</a> of any amount through PayPal. All donations are used to develop new templates and to keep the template site online. Top donors will get their name and link listed on the site (if wanted). Advertising options are also available. Contact me for more information!</p>
<h2>Sample links:</h2>
<ul>
<li><a href="http://andreasviklund.com/templates/">Free website templates</a></li>
<li><a href="http://andreasviklund.com/templates/commercial/">Commercial templates</a></li>
<li><a href="http://andreasviklund.com/wordpress-themes/">WordPress themes</a></li>
</ul>
<h2>Sample search:</h2>
<form action="get" id="searchbox">
<div>
<label for="searchform">Find:</label>
<input type="text" value="(demo only)" name="searchform" id="searchform" />
<input type="hidden" id="searchsubmit" value="(demo only)" />
</div>
</form>
<h2>Version:</h2>
<p>andreas00 v2.2<br />
(Apr 24, 2008)</p>
</div>
<div id="content">
<h2 align="center"> <span class="titulo">.: Fale Conosco:.</span></h2>
<div>
<div align="center">
<form id="form1" method="post" action="<?php $_SERVER['PHP_SELF']; ?>">
<table width="97%" height="355" border="0">
<tr>
<td width="31%"> </td>
<td width="69%"><label for="txtnome"></label>
</tr>
<tr>
<td>Nome:</td>
<td><label for="txtnome"></label>
<span id="sprytextfield1">
<input type="text" name="txtnome" id="txtnome" />
<span class="textfieldRequiredMsg">Campo Obrigatório.</span></span></td>
</tr>
<tr>
<td>Email:</td>
<td><label for="txtemail"></label>
<span id="sprytextfield2">
<input type="text" name="txtemail" id="txtemail" />
<span class="textfieldRequiredMsg">Campo Obrigatório.</span><span class="textfieldInvalidFormatMsg">Email inválido.</span></span></td>
</tr>
<tr>
<td height="121">Mensagem:</td>
<td><label for="txtmsg"></label>
<span id="sprytextarea1">
<textarea name="txtmsg" id="txtmsg" cols="45" rows="5"></textarea>
<span class="textareaRequiredMsg">Campo Obrigatório.</span><span class="textareaMinCharsMsg">Número mínimo de caracteres não atendido.</span><span class="textareaMaxCharsMsg">Número máximo de caracteres excedido.</span></span></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="button" id="button" value="Enviar" />
<input name="enviado" type="hidden" id="enviado" value="1" /></td>
</tr>
</table>
<p> </p>
</form>

muito obrigado por toda ajuda amigo! sou novo aqui no forum, e sempre estarei ajudando quando souber também!

admiro pessoas como você!

abraços

Link para o comentário
Compartilhar em outros sites

só encontrei um problema na finalização do formulário ...

depois de vocês me ajudarem, esbarrei em alguns problemas, mas consegui resolver !

ao finalizar o formulário, e enviar o email tudo certo...

ao invés de ele enviar assim:

-

Nome: "nome da pessoa"

Email: "email da pessoa"

Mensagem: "mensagem"

-

está enviando assim:

-

Nome: "nome da pessoa"Email: "email da pessoa"Mensagem: "mensagem da pessoa"

-

queria que fizesse o grande favor de me ajudar nesse problema.. por mais simples que seja, não estou conseguindo arrumar !..

segue o código:



<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$enviado = $_POST ['enviado'];
$nome = $_POST ['txtnome'];
$email = $_POST ['txtemail'];
$msg = $_POST ['txtmsg'];
echo ('<script>alert(\'Mensagem Enviada.\')</script>');

}
?>
<?php require('mailer/phpmailer.php'); ?>
<?php

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$mensagem="Nome: ".$nome."</br>";
$mensagem.="Email: ".$email."</br>";
$mensagem.="Mensagem: ".$msg."</br>";
$mail = new PHPMailer();

//Informa que será utilizado o SMTP para envio do e-mail
$mail->IsSMTP();
//Informa que a conexão com o SMTP será autênticado
$mail->SMTPAuth = true;
//Configuração de HOST do SMTP
$mail->Host = "smtp.mail.yahoo.com.br";
//Usuário para autênticação do SMTP
$mail->Username = "[email protected]";
//Senha para autênticação do SMTP
$mail->Password = "*****";
//Titulo do e-mail que será enviado
$mail->Subject = "Formulário de contato";
$mail->Port=25;
//Preenchimento do campo FROM do e-mail
$mail->From = $mail->Username;
$mail->FromName = "nome";


//E-mail para a qual o e-mail será enviado
$mail->AddAddress("[email protected]");

//Conteúdo do e-mail
$mail->Body = $mensagem;
$mail->AltBody = $mail->Body;

//Dispara o e-mail
if($enviado==1){
$enviar = $mail->Send();
}
}

?>

Link para o comentário
Compartilhar em outros sites

fiz assim, mas não deu certo ! :s


<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$enviado = $_POST ['enviado'];
$nome = $_POST ['txtnome'];
$email = $_POST ['txtemail'];
$msg = $_POST ['txtmsg'];
echo ('<script>alert(\'Mensagem Enviada.\')</script>');

}
?>
<?php require('mailer/phpmailer.php'); ?>
<?php

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$mensagem ="Nome: $nome</br>
Email: $email </br>
Mensagem: $msg</br>";
$mail = new PHPMailer();

//Informa que será utilizado o SMTP para envio do e-mail
$mail->IsHTML(true);
$mail->IsSMTP();
//Informa que a conexão com o SMTP será autênticado
$mail->SMTPAuth = true;
//Configuração de HOST do SMTP
$mail->Host = "smtp.mail.yahoo.com.br";
//Usuário para autênticação do SMTP
$mail->Username = ""email"@yahoo.com.br";
//Senha para autênticação do SMTP
$mail->Password = "******";
//Titulo do e-mail que será enviado
$mail->Subject = "Formulário de contato";
$mail->Port=25;
//Preenchimento do campo FROM do e-mail
$mail->From = $mail->Username;
$mail->FromName = "nome";


//E-mail para a qual o e-mail será enviado
$mail->AddAddress("[email protected]");

//Conteúdo do e-mail
$mail->Body = $mensagem;
$mail->AltBody = $mail->Body;

//Dispara o e-mail
if($enviado==1){
$enviar = $mail->Send();
}
}

?>

Link para o comentário
Compartilhar em outros sites

consegui resolver o problema.

era simples, mas ralei pra resolver sozinho...

ao invés de ser assim:

-

if ($_SERVER['REQUEST_METHOD'] == 'POST') {

$mensagem ="Nome: $nome</br>

Email: $email </br>

Mensagem: $msg</br>";

$mail = new PHPMailer();

-

foi assim:

-

if ($_SERVER['REQUEST_METHOD'] == 'POST') {

$mensagem="Nome: ".$nome."<br />";

$mensagem.="Email: ".$email."<br />";

$mensagem.="Mensagem: ".$msg."<br />";

$mail = new PHPMaile

-

agradeço a ajuda!

abraços

Link para o comentário
Compartilhar em outros sites

  • Moderador

mas isso é a mesma coisa amigo.. você só concatenou as variaveis $mensagem com $nome

fez isso em cada linha.

que tinha sugestinado é uma junçao da mensagem em uma variavel só. e fazer em formato html. por isso passei a linha $mail-> isHTML(true);

Link para o comentário
Compartilhar em outros sites

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

Sobre o Clube do Hardware

No ar desde 1996, o Clube do Hardware é uma das maiores, mais antigas e mais respeitadas comunidades sobre tecnologia do Brasil. Leia mais

Direitos autorais

Não permitimos a cópia ou reprodução do conteúdo do nosso site, fórum, newsletters e redes sociais, mesmo citando-se a fonte. Leia mais

×
×
  • Criar novo...

 

GRÁTIS: ebook Redes Wi-Fi – 2ª Edição

EBOOK GRÁTIS!

CLIQUE AQUI E BAIXE AGORA MESMO!