Ver Mensaje Individual
  #4 (permalink)  
Antiguo 08/08/2005, 14:52
Avatar de lrunge
lrunge
 
Fecha de Ingreso: agosto-2005
Ubicación: En algun lugar de Caracas
Mensajes: 165
Antigüedad: 18 años, 9 meses
Puntos: 4
A ver este:

A ver si te sirve este, se compone de dos paginas, una que es donde introduces los datos, y la otra que lo recibe y los procesa para enviarlos por correo.

Yo lo he usado sin problemas., contacto.php la accion del formulario es envia_form_php.php, aqui te pongo las 2 paginas.

contacto.php

Código PHP:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
<
html
<
head
    <
title>Mándanos tus comentarios</title
</
head
<
form action="envia_form_php.php" method=post>
  <
table width="327" border="0">
    <
tr
      <
td width="74"><font color="#000000">Nombre</font></td>
      <
td width="12">:</td>
      <
td width="227"><input type=text name="nombre" size=30></td>
    </
tr>
    <
tr
      <
td><font color="#000000">E-Mail</font></td>
      <
td>:</td>
      <
td><input type=text name=email size=30></td>
    </
tr>
    <
tr
      <
td><font color="#000000">Ciudad</font></td>
      <
td>:</td>
      <
td><input name=ciudad type=text id="ciudad" size=30></td>
    </
tr>
    <
tr
      <
td><font color="#000000">Estado</font></td>
      <
td>:</td>
      <
td><input name=estado type=text id="estado" size=30></td>
    </
tr>
    <
tr
      <
td><font color="#000000">&nbsp;</font></td>
      <
td>&nbsp;</td>
      <
td>&nbsp;</td>
    </
tr>
    <
tr
      <
td><font color="#000000">Asunto</font></td>
      <
td>:</td>
      <
td><input name=asunto type=text id="asunto" size=30></td>
    </
tr>
    <
tr
      <
td><font color="#000000">Comentario</font></td>
      <
td>:</td>
      <
td><textarea name=coment cols=50 rows=6></textarea></td>
    </
tr>
    <
tr
      <
td>&nbsp;</td>
      <
td>&nbsp;</td>
      <
td>&nbsp;</td>
    </
tr>
    <
tr
      <
td colspan="3"><div align="center">
          <
input name="submit" type=submit value="Enviar">
                  </
div></td>
    </
tr>
  </
table>
  <
p>&nbsp; </p>
</
form
</
body
</
html

envia_form_php.php

Código PHP:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> 
<html> 
<head> 
    <title>Mándanos tus comentarios</title> 
</head> 
<? 
if (!$HTTP_POST_VARS){ 
?> 
<form action="envia_form_php.php" method=post>
  <table width="327" border="0">
    <tr> 
      <td width="74"><font color="#000000">Nombre</font></td>
      <td width="12">:</td>
      <td width="227"><input type=text name="nombre" size=30></td>
    </tr>
    <tr> 
      <td><font color="#000000">E-Mail</font></td>
      <td>:</td>
      <td><input type=text name=email size=30></td>
    </tr>
    <tr> 
      <td><font color="#000000">Ciudad</font></td>
      <td>:</td>
      <td><input name=ciudad type=text id="ciudad" size=30></td>
    </tr>
    <tr> 
      <td><font color="#000000">Estado</font></td>
      <td>:</td>
      <td><input name=estado type=text id="estado" size=30></td>
    </tr>
    <tr> 
      <td><font color="#000000">&nbsp;</font></td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr> 
      <td><font color="#000000">Asunto</font></td>
      <td>:</td>
      <td><input name=asunto type=text id="asunto" size=30></td>
    </tr>
    <tr> 
      <td><font color="#000000">Comentario</font></td>
      <td>:</td>
      <td><textarea name=coment cols=50 rows=6></textarea></td>
    </tr>
    <tr> 
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr> 
      <td colspan="3"><div align="center">
          <input name="submit" type=submit value="Enviar">
          <? 
}else{ 
    
//Estoy recibiendo el formulario, compongo el cuerpo 
    
$cuerpo "Formulario enviado\n"
    
$cuerpo .= "Nombre: " $HTTP_POST_VARS["nombre"] . "\n"
    
$cuerpo .= "Email: " $HTTP_POST_VARS["email"] . "\n";
    
$cuerpo .= "Ciudad: " $HTTP_POST_VARS["ciudad"] . "\n"
    
$cuerpo .= "Estado: " $HTTP_POST_VARS["estado"] . "\n";
    
$cuerpo .= "Asunto: " $HTTP_POST_VARS["asunto"] . "\n";
    
$cuerpo .= "Comentarios: " $HTTP_POST_VARS["coment"] . "\n"

    
//mando el correo... 
    
mail("[email protected]","Informacion enviada desde www.mipagina.com",$cuerpo); 

    
//doy las gracias por el envío 
    
echo "Gracias por enviarnos sus comentarios"

?>
        </div></td>
    </tr>
  </table>
  <p>&nbsp; </p>
</form> 
</body> 
</html>