Ir para conteúdo
Fórum Script Brasil
  • 0

fomulario php com anexo


Hot Micros

Pergunta

Boa Noite Senhores (as)

Sou novo por aqui, gostaria de uma ajuda de vocês.

Antes de colocar o codigo abaixo, já revirei o forum e fazendo testes, e não deu certo, cada hora da um erro diferente.

Gostaria de colocar um campo no meu formulario que anexa arquivo, se alguém souber.. agradeço desde já

ai vai:

FORM2.PHP

<!-- INICIO DO FORMULÁRIO -->

<form name="form2" method="POST" action="form2/email.php" style="color: #000000">

<div align="center">

<center>

<table width="713" border="0" cellspacing="0" cellpadding="2" style="border-collapse: collapse" bordercolor="#111111" height="177" align="left">

<tr bgcolor="">

<td valign="top" width="290" nowrap align="right" height="21">

<font face="Verdana" size="2" color="#FFFFFF">Nome</font></td>

<td width="844" height="21" align="left">

<input class="form2_campos" type="text" name="nome" size="40" style="font-family: arial; font-size: 8 pt">

</td>

</tr>

<tr bgcolor="">

<td valign="top" width="290" nowrap align="right" height="21">

<font class="texto" size="2" face="Verdana" color="#FFFFFF">Cidade</font></td>

<td width="844" height="21" align="left">

<input class="form2_campos" type="text" name="cidade" size="40" style="font-family: arial; font-size: 8 pt">

-

<input class="form_campos" type="text" name="estado" size="2" style="font-family: arial; font-size: 8 pt"></td>

</tr>

<tr bgcolor="">

<td valign="top" width="290" nowrap align="right" height="21">

<font class="texto" size="2" face="Verdana" color="#FFFFFF">E-mail:</font></td>

<td width="844" height="21" align="left">

<input class="form_campos" type="text" name="email" size="40" style="font-family: arial; font-size: 8 pt">

</td>

</tr>

<tr bgcolor="">

<td valign="top" width="290" nowrap align="right" height="20">

<font face="Verdana" size="2" color="#FFFFFF">Telefone:</font></td>

<td width="844" height="20" align="left">

<input class="form_campos" type="text" name="fone" size="40" style="font-family: arial; font-size: 8 pt"></td>

</tr>

<tr bgcolor="">

<td valign="top" width="290" nowrap align="right" height="20">

<font face="Verdana" size="2" color="#FFFFFF">Sexo:</font></td>

<td width="844" height="20" align="left">

<input class="form_campos" type="text" name="sexo" size="5" style="font-family: arial; font-size: 8 pt"></td>

</tr>

<tr bgcolor="">

<td valign="top" width="290" nowrap align="right" height="20">

<font face="Verdana" size="2" color="#FFFFFF">Altura:</font></td>

<td width="844" height="20" align="left">

<input class="form_campos" type="text" name="altura" size="5" style="font-family: arial; font-size: 8 pt"></td>

</tr>

<tr bgcolor="">

<td valign="top" width="290" nowrap align="right" height="20">

<font face="Verdana" size="2" color="#FFFFFF">Manequim:</font></td>

<td width="844" height="20" align="left">

<input class="form_campos" type="text" name="manequim" size="5" style="font-family: arial; font-size: 8 pt"></td>

</tr>

<tr bgcolor="">

<td valign="top" width="290" nowrap align="right" height="21">

<font class="texto" size="2" face="Verdana" color="#FFFFFF">Assunto:</font></td>

<td width="844" style="color: #000000" height="21" align="left">

<select class="form_campos" name="assunto" style="font-family: Verdana; font-size: 8 pt; color:#000000">

<option value="CONTATO ATRAVÉS DE WWW.DOMINIO.COM.BR">Contato

</option>

<option>Casting</option>

<option>Serviços</option>

<option>Novidades</option>

<option class="form_campos" value="Suporte Outros">Outros</option>

<option selected>

Contato

</option>

</select>

</td>

</tr>

<tr bgcolor="">

<td valign="top" width="290" nowrap align="right" height="19">

<font class="texto" size="2" face="Verdana" color="#FFFFFF">Mensagem:</font></td>

<td width="844" height="19" align="left">

<textarea class="form_campos" name="mensagem" cols="40" rows="1" style="font-family: arial; font-size: 8 pt"> </textarea>

</td>

</tr>

<tr bgcolor="">

<td colspan="2" width="1138" height="26" align="center">

<div align="left">

<b>

<span style="font-size: 8pt">

<input class="form_botao" type="reset" name="Limpar" value="Limpar" style="float: right"><input class="form_botao" type="submit" name="Enviar" value="Enviar Mensagem" style="float: right">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><font face="Verdana" size="2"><a href="mailto:nome@dominio.com.br?subject=Casting / Fotos">Clique

aqui para enviar suas fotos !</a></font></b></div>

</td>

</tr>

</table>

</center>

</div>

</form>

<!-- FIM DO CÓDIGO DO FORMULÁRIO -->

----------------------------------------------------------------

CONFIG.PHP

* Altere a variavel $mail_destino para o seu email

*

*/

//Seu email, para onde irao as informações do formulário

$mail_destino = "nome@dominio.com.br";

//Mensagem de cabeçalho do email

$mail_header = "Mensagem enviada pelo formulário do Formulário de Contato.";

//Mensagem para o email de resposta

$msg_reply = "Olá $nome, recebemos o seu email com o assunto <b>$assunto</b>. Obrigado por entrar em contato.";

//Mensagem de Erro

$msg_erro = "Atenção!<font color=$cor_site><b>Por favor Preencha todos os campos do fomulário corretamente</b></font> Obrigado!";

?>

-------------------------------------------------------------------

EMAIL.PHP

<?php

include("config.php");

//Testa campos obrigatórios

if ($nome!="" and $mensagem!="" and $email!="" and $cidade!=""and $fone!=""and $sexo!=""and $altura!=""and $manequim!=""and $assunto!="")

{

$msg.="Nome: $nome\n";

$msg.="Cidade: $cidade\n";

$msg.="Estado: $estado\n";

$msg.="E-mail: $email\n";

$msg.="Fone: $fone\n";

$msg.="Sexo: $sexo\n";

$msg.="Altura: $altura\n";

$msg.="Manequim: $manequim\n";

$msg.="Assunto: $assunto\n";

$msg.="$mensagem\n";

if (@ mail ($mail_destino, $assunto, $msg, $mail_header))

{

//Imprimindo confirmação de envio

echo

"

<html>

<meta http-equiv=refresh content=2;URL=http://www.dominio.com.br/></html>";

echo "$nome, sua mensagem:<br> $mensagem <br>Foi enviada com sucesso!<br>";

echo "Obrigado!<br><br>

";

//Enviando mensagem de confirmação para o email do internauta

@ mail ($email, "Re: $assunto", $msg_repy, $mail_header);

}

else

echo

"

<meta http-equiv=refresh content=5;URL=index.php>

</html><center><br><br><font color=red>

<b>Erro ao enviar e-mail!</b>

</font></center>

";

}

else

{

//Alerta sobre os campos obrigatórios

echo

"

<br><br><center>

$msg_erro <br><br>

<a href=\"java script:window.history.go(-1)\" class=\"links\">Por favor, volte e preencha corretamente.</a>

</center>

";

}

?>

-----------------------------------------------------------------------

- gostaria que este formulario funcionasse com anexar arquivos, desculpe mas já tentei e não consegui.

Obrigado e aguardo

Ricardo - Hotmicros.

Editado por Hot Micros
Link para o comentário
Compartilhar em outros sites

1 resposta a esta questão

Posts Recomendados

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152,2k
    • Posts
      652k
×
×
  • Criar Novo...