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

Formnulario


hsimberg

Pergunta

gente, como faz de uma maneira mais simples possivel um formulario eu sei q tem que ter o form.php que seria mais ou menos isso:

<form name="form2" method="post" action="envia.php">

  <input type="text" name="textfield">

  <input type="submit" name="Submit" value="Enviar">

</form>

ta, esse seria onde teria o formulario....eu gostaria de saber o que tem que ter no envia.php....o que eu tenho que colocar? onde eu coloco meu email ai?

Link para o comentário
Compartilhar em outros sites

4 respostass a esta questão

Posts Recomendados

  • 0

Um formularios simples:

<html>

<head>

<form name="form" action="enviar.php" method="post">

  <p>&nbsp;</p>

 

  <table width="68%"  border="0" align="center" cellpadding="4" cellspacing="0" class="Table">

    <tr align="center" class="TableTitle">

      <td colspan="2"><span class="style2">Formulario simples:</span></td>

    </tr>

    <tr class="TableCell">

      <td width="31%" align="right"><strong><font color="#FF0000">Nome </font></strong><font color="#FF0000"><strong> :</strong></font></td>

      <td width="69%">

        <input name="nome" type="text" id="nome" value="">

      </td>

    </tr>

    <tr class="TableCell">

      <td align="right"><strong><font color="#FF0000">Senha :</font></strong></td>

      <td>

        <input name="senha" type="password" id="senha" value="" size=25 maxlength="20">

      </td>

    </tr>

    <tr class="TableCell">

      <td align="right"><strong><font color="#FF0000">Telefone :</font></strong></td>

      <td>

        <input name="telefone" type="text" id="telefone" value="" size="25" maxlength="15">

      </td>

    </tr>

    <tr class="TableCell">

      <td align="right"><strong><font color="#FF0000">Email</font></strong><font color="#FF0000">

        <strong>:</strong></font></td>

      <td class="style1"><input name="email" type="text" id="email" value="" size="25"></td>

    </tr>

    <tr class="TableCell">

      <td align="right"><strong><font color="#FF0000">Seu IP :</font></strong></td>

      <td class="style1">

        <input name="ip" type="text" id="ip" value="<? echo $_SERVER["REMOTE_ADDR"]; ?>"readonly=true size="15">

      </td>

    </tr>

    <tr class="TableCell">

      <td align="right" class="style1">&nbsp;</td>

      <td class="style1"><textarea name="mensagem" cols="40" rows="8" id="mensagem"></textarea></td>

    </tr>

    <tr class="TableCell">

      <td align="right" class="style1">&nbsp;</td>

      <td class="style1"><input name="submit" type="submit" value="Enviar"></td>

    </tr>

  </table>

</form>

<p align="center" class="style1">&nbsp;</p>

</body>

</html>

enviar.php

<?

foreach ($_POST as $campo => $valor) { $$campo = $valor; }

if (!$mensagem ) {

    echo "<DIV align = center><p align = center >Por Favor Escreva uma mensagem<br>";

    echo "<a href=\"javascript:history.back(1)\">Voltar</a>";

  }else{

   echo "

                    <tr>

                     <TD height = \"22\" colspan = \"3\"> <p align = center>Olá

                       <font color = #FF0000><b>$nome</b></font></TD>

                    </tr>

                   

     <tr>

                       <TD height = \"22\" colspan = \"3\"> <p align = center>As Informações Foram Enviadas com Sucesso!</font></TD>

                    </TR>

                   

     <tr>

                      <TD height = \"22\"></TD>

                       <TD></TD>

                       <TD></TD>

                    </tr>

                   

     <TR>

                      <TD height = \"23\" colspan = \"3\"> <p align = center>Em Breve Entraremos em Contato.</font></TD>

                    </TR>

                   

     <tr>

                      <TD height = \"23\" colspan = \"3\"> <p align = center>Atenciosamente!

                      </TD>

                    </tr>";

    

$mens  = "<font size = \"2\" face = Verdana><p align = center><p align = center>::Formulario::<br><br></p></p></font>";

$mens .= "<font size = \"2\" face = Verdana><font color = #FF0000>nome:</font></font> $nome<br>";

$mens .= "<font size = \"2\" face = Verdana><font color = #FF0000>senha:</font></font> $senha<br>";

$mens .= "<font size = \"2\" face = Verdana><font color = #FF0000>Telefone:</font></font> $telefone<br>";

$mens .= "<font size = \"2\" face = Verdana><font color = #FF0000>Email:</font></font> $email<br><br>";

$mens .= "<font size = \"2\" face = Verdana><font color = #FF0000>Mensagem:</font></font> $mensagem<br><br>";

$headers = "MIME-Version: 1.0\r\n";

$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";

$headers .= "From: 'Pedido'\r\n";

   mail("seuemail","Formulário","$mens", $headers);

echo "                    <TR>

                      <TD height=13> </TD>

                      <TD></TD>

                      <TD></TD>

                    </TR>

                    <TR>

                      <TD height = \"12\"></TD>

                      <TD valign = top><div align = center><a href = formulario.php>Voltar</a></div></TD>

                      <TD></TD>

                    </TR>";

     }

?>                  

em vermelho coloque seu email

e configure no php.ini o smtp

Link para o comentário
Compartilhar em outros sites

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...