Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Galera criei um formulario de contato com varios destinarios
so que tipo quando você manda enviar ele vai di boa so que naum vai para o destinarios que a pessoa escolheu naum vai pa nenhum , mais ele recebe uma auto resposta normal
os codigos são esse aki
Contato.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">](http://www.w3.org/1999/xhtml)
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script language="JavaScript" type="text/JavaScript">
<!--
function checa_formulario(email){
if (email.nome.value == ""){
alert("Por Favor nao deixe o seu nome em branco!!!");
email.nome.focus();
return (false);
}
if (email.email.value == ""){
alert("Por Favor nao deixe o seu e-mail em branco!!!");
email.email.focus();
return (false);
}
if (email.assunto.value == ""){
alert("Por Favor nao deixe o seu Assunto em branco!!!");
email.assunto.focus();
return (false);
}
}
//-->
</script>
</head>
<body onload="document.email.nome.focus();">
<form action="enviar.php" method="post" enctype="multipart/form-data" name="email" id="email" onsubmit="return checa_formulario(this)">
<table width="600" border="0" cellspacing="0" cellpadding="1">
<tr>
<td> </td>
<td></td>
<td><font size="-5">Obs: campos com </font><font size="-5" color="#FF0000">(*)</font><font size="-5"> são obrigatorios!</font></td>
</tr>
<tr>
<td width="90">Nome:</td>
<td width="290"><input name="nome" type="text" value="" /> </td>
<td width="220"> </td>
</tr>
<tr>
<td>Email:</td>
<td><input name="email" type="text" /> </td>
<td> </td>
</tr>
<tr>
<td>Sala:<br /></td>
<td><label>
<input type="text" name="sala" id="sala" />
</label></td>
<td> </td>
</tr>
<tr>
<td>Turno:</td>
<td><label>
<input type="text" name="turno" id="turno" />
</label></td>
<td> </td>
</tr>
<tr>
<td>Série:</td>
<td><label>
<input type="text" name="serie" id="serie" />
</label></td>
<td> </td>
</tr>
<tr>
<td>Para:</td>
<td><label>
<select name="Contatos" size="1" id="Contatos">
<option>-------Escolha------</option>
<option value="diretoria">Diretoria</option>
<option value="secretaria">Secretaria</option>
<option value="prof. alba">Prof. Alba</option>
<option value="prof. andreia">Prof. Andreia</option>
<option value="prof. eliane">Prof. Eliane</option>
<option value="Prof. elizabete">Prof. Elizabete</option>
<option value="prof. eunice">Prof. Eunice</option>
<option value="prof.gamariel">Prof. Gamariel</option>
<option value="prof. jose flavio">Prof. José Flavio </option>
<option value="prof. joao marcos a">Prof. João Marcos A. Melo</option>
<option value="prof. joao marcos c">Prof. João Marcos C. Dos santos</option>
<option value="prof. julia">Prof. Julia </option>
<option value="prof. juliana">Prof. Juliana </option>
<option value="prof. luci">Prof. Luci</option>
<option value="prof. luiz otavio">Prof. Luiz Otavio</option>
<option value="prof. luiz rogerio">Prof. Luiz Rogério </option>
<option value="prof. luzia">Prof. Luzia</option>
<option value="prof. luzimar">Prof. Luzimar</option>
<option value="prof. marcelo">Prof. Marcelo</option>
<option value="prof. marcia">Prof. Marcia</option>
<option value="prof. maria ester">Prof. Maria Ester </option>
<option value="prof. maria rita">Prof. Maria Rita </option>
<option value="prof. maria vania">Prof. Maria Vânia</option>
<option value="prof. marta">Prof. Marta </option>
<option value="prof. mercia">Prof. Mercia</option>
<option value="prof. Nilton">Prof.Nilton</option>
<option value="prof. patricia">Prof. Patricia</option>
<option value="prof. ramon">Prof. Ramon</option>
<option value="prof. rosana">Prof. Rosana </option>
<option value="prof. rosangela">Prof. Rosangela </option>
<option value="prof. sidney">Prof. Sidney </option>
<option value="prof. tereza cristina">Prof. Tereza Cristina</option>
<option value="prof. tereza de oliveira">Prof. Tereza de Oliveira </option>
<option value="prof. valdirene">Prof. Valdirene </option>
</select>
</label></td>
<td> </td>
</tr>
<tr>
<td>Anexo:</td>
<td><label>
<input type="file" name="anexo" id="anexo" />
</label></td>
<td> </td>
</tr>
<tr>
<td>Assunto:</td>
<td><label>
<input type="text" name="assunto" id="assunto" />
</label></td>
<td> </td>
</tr>
<tr>
<td valign="top">Mensagem:</td>
<td><label>
<textarea name="mensagem" id="mensagem" cols="45" rows="5"></textarea>
</label></td>
<td valign="top"><table width="108" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="108" height="12">
<font size="-5" face="Verdana, Geneva, sans-serif" color="#FF0000" ><strong>Obs:Aceita html</strong></font>
</td>
</tr>
</table></td>
</tr>
<tr>
<td> </td>
<td align="right"><label>
<input type="submit" name="Enviar" id="Enviar" value="enviar" />
</label></td>
<td> </td>
</tr>
</table></form>
</body>
</html>Enviar.php
<?php
$nome = $_POST["nome"];
$sala = $_POST["sala"];
$turno = $_POST["turno"];
$serie = $_POST["serie"];
$Contatos = $_POST["Contatos"];
$email = $_POST["email"]; //EMAIL DO CONTATO, ESTAVA O MESMO NOME DO EMAIL DESTINATARIO
$assunto = $_POST["assunto"];
$mensagem = $_POST["mensagem"]; // FALTOU PEGAR A MENSAGEM
switch ($contatos) {// CORRIGIDO, você ESTAVA PEGANDO O VARIAVEL ASSUNTO
case "secretaria":
$destinatario = "secretaria@eewbonline.com.br";
break;$destinatario = "alba.p@eewbonline.com.br";
break;$destinatario = "andrea.a@eewbonline.com.br";
break;$destinatario = "eliane.c@eewbonline.com.br ";
break;$destinatario = "elizabete.c@eewbonline.com.br";
break;$destinatario = "eunice.b@eewbonline.com.br";
break;$destinatario = "gamariel.c@eewbonline.com.br";
break;$destinatario = "jose.f@eewbonline.com.br";
break;$destinatario = "joao.m@eewbonline.com.br";
break;$destinatario = "joao.mc@eewbonline.com.br";
break;$destinatario = "julia.t@eewbonline.com.br";
break;$destinatario = "juliana.s@eewbonline.com.br";
break;$destinatario = "luci.f@eewbonline.com.br";
break;$destinatario = "luiz.o@eewbonline.com.br";
break;$destinatario = "luiz.r@eewbonline.com.br";
break;$destinatario = "luzia.f@eewbonline.com.br";
break;$destinatario = "luzimar.b@eewbonline.com.br";
break;$destinatario = "marcelo.a@eewbonline.com.br";
break;$destinatario = "marcia.c@eewbonline.com.br";
break;$destinatario = "maria.e@eewbonline.com.br";
break;$destinatario = "maria.r@eewbonline.com.br";
break;$destinatario = "maria.v@eewbonline.com.br";
break;
case "prof. marta":
$destinatario = "marta.n@eewbonline.com.br";
break;$destinatario = "mercia.t@eewbonline.com.br";
break;$destinatario = "nilton.c@eewbonline.com.br";
break;$destinatario = "patricia.s@eewbonline.com.br";
break;$destinatario = "ramon.g@eewbonline.com.br";
break;$destinatario = "rosana.m@eewbonline.com.br";
break;$destinatario = "rosangela.b@eewbonline.com.br";
break;
case "prof. sidney":
$destinatario = "sidney.l@eewbonline.com.br";
break;$destinatario = "tereza.@eewbonline.com.br";
break;$destinatario = "tereza.o@eewbonline.com.br";
break;$destinatario = "valdirene.m@eewbonline.com.br";
break;$destinatario = "diretoria@eewbonline.com.br";
break;
}
$MailRecipiente = $destinatario;
$MailAssunto = $assunto;
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: $destinatario\r\n";
$headers .= "Return-Path: $destinatario\r\n";
$msg = '
Nome: '.$nome.'<br/>
Email: '.$email.'<br/>
Assunto: '.$assunto.'<br/><br/>
sala: '.$sala.'<br />
Série: '.$serie.'<br />
Turno: '.$turno.'<br />
'.$mensagem.'
';
mail($MailRecipiente,$MailAssunto,$msg,$headers);
//AUTO RESPOSTA
$headers_ = "MIME-Version: 1.0\r\n";
$headers_ .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers_ .= "From: $email\r\n";
$site = "EEWBONLINE.COM.BR";
$titulo = "EEWB Online";
$mensagem = "
Obrigado $nome Pelo contato!Logo Seu Email Será Respondido!<br>
Pedimos Por Gentileza Para Que Envie Sua Opinião do site para o email admin@eewbonline.com.br!
Grato,<br> <p>EEWB Online!";
mail($email,$titulo,$mensagem,$headers_);
echo "<script>
alert('Seu email foi enviado com sucesso!');top.location.href='index?pg=contato';
</script>\n\n";
?>Carregando comentários...