Ver Mensaje Individual
  #8 (permalink)  
Antiguo 03/04/2008, 12:38
Avatar de ongraphic
ongraphic
 
Fecha de Ingreso: marzo-2008
Ubicación: Bogotá Colombia
Mensajes: 24
Antigüedad: 16 años
Puntos: 0
Re: Formulario para mi web

yo utilize el sigueibte codigo para mi formulario para enviarlo a mi correo me lo facilitaron aqui en foros del web:

un archivo html que llame contactenos.html con lo siguiente:


<table width="700" height="181" border="0" cellpadding="0" cellspacing="0">
<tr>
<th scope="col">
<form id="contacto" name="contacto" action="datos.php" method="POST">
<table align="center" border="0">
<tr>
<td align="left" width="100">NOMBRE:</td>
<td align="center" width="150"><input name="nombre" type="text" id="nombre" onblur="MM_validateForm('nombre','','R');return document.MM_returnValue" size="30" /></td>
<td><span class="style2">
*</span></td>
</tr>
<tr>
<td align="left" width="100">EMPRESA:</td>
<td align="center" width="150"><input name="empresa" type="text" id="empresa" onblur="MM_validateForm('empresa','','R');return document.MM_returnValue" size="30" /></td>
<td><span class="style2">
*</span></td>
</tr>
<tr>
<td align="left" width="100">E-MAIL:</td>
<td align="center" width="150"><input name="mail" type="text" id="mail" onblur="MM_validateForm('mail','','NisEmail');retu rn document.MM_returnValue" size="30" /></td>
<td><span class="style2">
*</span></td>
</tr>
<tr>
<td align="left" width="100">TELEFONO:</td>
<td align="center" width="150"><input name="telefono" type="text" id="telefono" onblur="MM_validateForm('telefono','','R');return document.MM_returnValue" size="30" /></td>
<td>
<span class="style2">*</span></td>
</tr>
<tr>
<td align="left" width="100"> MENSAJE:</td>
<td><textarea name="mensaje" cols="40" rows="8" id="mensaje"></textarea></td>
</tr>
<tr>
<td widht="100"></td>
<td align="right" width="150"><input name="Submit" type="submit" onclick="MM_validateForm('nombre','','R','empresa' ,'','R','mail','','RisEmail','telefono','','R');re turn document.MM_returnValue" value="Enviar" /></td>
</tr>
</TABLE>
<p class="style2">* Campo obilgatorio</p>
</FORM>
</th>
</tr>
</table>

un archivo php con javascript llamado datos.php con:

<?
$nombre = $_POST['nombre'];
$mail = $_POST['mail'];
$empresa = $_POST['empresa'];
$telefono = $_POST['telefono'];

$mensaje = 'From: ' . $mail . " \r\n";
$mensaje .= "X-Mailer: PHP/" . phpversion() . " \r\n";
$mensaje .= "Mime-Version: 1.0 \r\n";
$mensaje .= "Content-Type: text/plain";

$header = "Este mensaje fue enviado por " . $nombre . ", de la empresa " . $empresa . " \r\n";
$header .= "Su e-mail es: " . $mail . ", Su telefono es: " . $telefono . " \r\n";
$header .= "Mensaje: " . $_POST['mensaje'] . " \r\n";
$header .= "Enviado el " . date('d/m/Y', time());


$para = '[email protected]';

mail($para,$mensaje,$header);

echo "<script languaje=javascript> alert('Su mensaje fue enviado correctamente') </script>";
echo "<script languaje=javascript> document.location='inicio.html' </script>";
?>