Crie o arquivo index.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Sistema de envio de email</title>
<style type="text/css">
<!--
.style1 {
font-size: 20px;
font-weight: bold;
}
.style2 {
font-size: 24px;
font-weight: bold;
}
.campos {
background-color:#F8D07B;
font: 11px georgia, sans-serif;
color:#000000;
border-width:3px;
border-color:#000000;
margin-right: 20px;
}
.submit input
{
color: #000;
background: #ffa20f;
border: 2px outset #d7b9c9
}
input
{
color: #000000;
background: #fee3ad;
border: 1px solid #781351
}
-->
</style>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<?php
//se o cara clicou no botao enviar
if($_POST['envia'])
{
//atribui os nomes das cidades referente a cidade escolhida no formulario
if($_POST['cidade'] == "bh")
{
$cidade = "Belo Horizonte";
}
if($_POST['cidade'] == "co")
{
$cidade = "Contagem";
}
if($_POST['cidade'] == "be")
{
$cidade = "Betim";
}
if($_POST['cidade'] == "sta")
{
$cidade = "Santa Luzia";
}
//aqui atribui texto ao Tipo de pagamento escolhido no fomulario
if($_POST['pagamento'] == "pag1")
{
$pagamento = "À vista com vencimento em 09/07/2007: R$850,00";
}
if($_POST['pagamento'] == "pag2")
{
$pagamento = "À vista com vencimento em 06/07/2007: R$750,00";
}
//cria o corpo do Email
$corpo = "Formulário enviado\n\n";
$corpo .= "Forma de pagamento: " . $pagamento . "\n";
$corpo .= "Nome: " . $_POST["nome"] . "\n";
$corpo .= "Sexo: " . $_POST['sexo'] . "\n";
$corpo .= "RG: " . $_POST['rg'] . "\n";
$corpo .= "Orgão Expedidor: " . $_POST['oe'] . "\n";
$corpo .= "Endereço: " . $_POST['endereco'] . "\n";
$corpo .= "Complemento: " . $_POST['complemento'] . "\n";
$corpo .= "Bairro: " . $_POST['bairro'] . "\n";
$corpo .= "CEP: " . $_POST['cep'] . "\n";
$corpo .= "Celular: " . $_POST['celular'] . "\n";
$corpo .= "Telefone Fixo: " . $_POST['telfixo'] . "\n";
$corpo .= "Cidade: " . $cidade . "\n";
$corpo .= "Outra Cidade: " . $POST['outra'] . "\n";
//envio o email...
$envia = mail("email@que.vai.receber.com","Titulo - Aprendi a como criar formulario de email",$corpo);
//se o envio for OK ele exibe a msg
if($envia)
{
//Email OK
echo "Obrigado por preencher o formulário. Foi enviado corretamente.";
}
//se der Erro ao enviar email
else
{
echo "Erro ao enviar o cadastro. Desculpe o transtorno.";
}
}
?>
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="49"><div align="center">
<table width="100%" height="37%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#FF9933"> </td>
</tr>
</table>
<p><img src="../pics/logomarca.gif" width="233" height="58" /><br />
<br />
</p>
</div></td>
</tr>
<tr>
<td height="23" bgcolor="#FF9933"><div align="center"><img src="../pics/titu_conteudo_index.gif" width="368" height="21" /></div></td>
</tr>
<tr>
<td height="330"><table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<!-- Borda Esquerda -->
<form action="<?php echo "$_SERVER[PHP_SELF]"; ?>" method="POST">
<td width="30%" bgcolor="#CCCCCC"> </td>
<td width="40%" align="left" valign="top">
<table width="100%" height="106%" border="0" cellpadding="5" cellspacing="30">
<tr>
<td height="314" align="left" valign="top"><p class="style2">INSCRIÇÃO EM EVENTO</p>
<p class="style1">Gerenciamento de Projetos </p>
<p> </p>
<p><strong>Forma de pagamento </strong></p>
<p>
<select name="pagamento" class="campos">
<option value=""> </option>
<option value="pag1"> - À vista com vencimento em 09/07/2007: R$850,00</option>
<option value="pag2"> - À vista com vencimento em 06/07/2007: R$750,00</option>
</select>
</p>
<p class="style1">Dados pessoais</p>
<table width="626" border="0">
<tr>
<td width="308">
<strong>Nome:
<input name="nome" type="text" size="38" class="campos" />
</strong> </td>
<td width="308">
<strong>Sexo:
<select name="sexo" class="campos">
<option value="masculino">Masculino</option>
<option value="feminino">Feminino</option>
</select>
</strong> </td>
</tr>
<tr>
<td><strong>Identidade: <input name="rg" type="text" class="campos" /></strong></td>
<td><strong>Órgão Expedidor: <input name="oe" type="text" class="campos" value="SSP-MG" size="15" /></strong></td>
</tr>
</table>
<table width="626" border="0">
<tr>
<td width="308"><strong>Endereço:
<input name="endereco" type="text" class="campos" size="34" />
</strong> </td>
<td width="308"><strong>Complemento: </strong> <strong>
<input name="complemento" type="text" class="campos" size="20" />
</strong></td>
</tr>
<tr>
<td><strong>Bairro:
<input name="bairro" type="text" class="campos" id="bairro" />
</strong></td>
<td><strong>CEP:
<input name="cep" type="text" class="campos" id="cep" size="20" />
</strong></td>
</tr>
</table>
<table width="626" border="0">
<tr>
<td width="308"><strong>Celular:
<input name="celular" type="text" class="campos" id="celular" size="25" />
</strong> </td>
<td width="308"><strong>Fixo: </strong> <strong>
<input name="telfixo" type="text" class="campos" id="telfixo" size="25" />
</strong></td>
</tr>
<tr>
<td width="308"><strong>Cidade:
<select name="cidade" class="campos">
<option value=""></option>
<option value="bh">Belo Horizonte</option>
<option value="co">Contagem</option>
<option value="be">Betim</option>
<option value="sta">Santa Luzia</option>
</select>
</strong></td>
<td><strong>Outra cidade:
<input name="outra" type="text" class="campos" id="cidade" size="20" />
</strong>
</td>
</tr>
</table>
<table width="626" border="0">
<tr>
<td><strong>Email:
<input name="bairro22" type="text" class="campos" id="bairro22" size="35" />
</strong></td>
</tr>
</table>
<p> </p>
<p>
<input name="envia" type="submit" class="submit" value="Enviar" />
</p></td>
</tr>
</table> <p> </p></td>
<!-- BORDA DIREITA -->
<td width="30%" bgcolor="#CCCCCC"> </td>
</tr>
</table></td>
</tr>
<tr>
<td bgcolor="#FF9933"><div align="center"><font color="#000000">Copyright liberado pode mexer em tudo copiar vender, ficar rico e por ai vai!</font> </div></td>
</tr>
</table>
</body>
</html>
Editado por kinzinho, 01 February 2008 - 01:14 PM.











