Ver Mensaje Individual
  #1 (permalink)  
Antiguo 26/05/2011, 09:23
bestebat2
 
Fecha de Ingreso: mayo-2011
Mensajes: 8
Antigüedad: 13 años
Puntos: 0
Codigo php para formulario contacto

Hola a todos, no se cómo adecuar estos códigos para que funcionen bien. Se trata de un´archivo HTML que llama a un PHP para que envíe un mail desde un formulario de contacto de una web.

Alguien puede echarme una mano por favor?

Dejo los 2 códigos:

ARCHIVO HTML (PARTE DE CODIGO DEL FORMULARIO):
<form enctype="multipart/form-data" name="" id="form" action="enviar.php">
<table>
<tr>
<td width="4" height="131"></td>
<td width="184" height="131">
<table>
<tr>
<td width="184" height="30">
<input type="text" value="Tu nombre:"><br>
</td>
</tr>
<tr>
<td width="184" height="30">
<input type="text" value="Teléfono:"><br>
</td>
</tr>
<tr>
<td width="184" height="71">
<input type="text" value="E-mail:"><br>
</td>
</tr>
</table>
</td>
<td width="176" height="131">
<textarea name="textarea" cols="35" rows="35">Escribe tu mensaje:</textarea><br>
<br style="line-height:5px ">
<img alt="" src="images/spacer.gif" width="38" height="1"><a href="#" class="more" onClick="document.getElementById('form').reset()"> borrar</a> <a href="#" class="more" onClick="document.getElementById('form').submit()" > enviar</a></td>
</tr>
</table>
</form>


CODIGO PHP DEL OTRO ARCHIVO LLAMADO "ENVIAR".
< ?php
$nombre = $_POST['nombre'];
$mail = $_POST['mail'];
$empresa = $_POST['empresa'];

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

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

$para = '[email protected];
$asunto = 'Contacto web';

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

echo '&estatus=ok&';

?>


Muchas gracias