Ver Mensaje Individual
  #1 (permalink)  
Antiguo 02/02/2012, 04:39
inafeces
 
Fecha de Ingreso: febrero-2012
Mensajes: 5
Antigüedad: 12 años, 3 meses
Puntos: 0
Pregunta Problema envio formulario PHP + Form en Divs

Hola:

Me encuentro realizando un website y el código que utilizo normalmente para envío de emails no funciona, parece que no llegan las variables desde el formulario html a la zona de php, podría deberse al uso de divs dentro del form?

Codigo HTML:

<br style="line-height:15px;">
<form id="form1" enctype="text/plain" action="mensajes_candido.php" method="post" name="form1">
<table style="width:auto;height:auto;">
<tr>
<td style="width:180px;">
Nombre:<br>
<div class="form"><input type="text" id="Name1"></div>
Empresa:<br>
<div class="form"><input type="text" id="Empresa1"></div>
Telefono:<br>
<div class="form"><input type="text" id="Phone1"></div>
E-mail:<br>
<div class="form"><input type="text" id="Email1"></div>
</td>
<td style="width:auto;">
Texto:<br>
<textarea rows="20" cols="30" id="Message1"></textarea><br>
<br style="line-height:10px;">
<font><a href="#" onclick="document.getElementById('form1').reset()" >Borrar</a></font>&nbsp; &nbsp; <font><a href="#" onclick="form1.submit()">Enviar</a> </font>
</td>
</tr>
</table>
</form>

Aclarar que he probado el envío a través de un botón submit y tampoco funciona

Código PHP (Envía los Emails pero lo hace con los campos vacios):

<?php

$message = $HTTP_POST_VARS['Message1'];
$name = $_POST['Name1'];
$email = $HTTP_POST_VARS['Email1'];
$phone = $_POST['Phone1'];

$name = stripslashes($name);
$email = stripslashes($email);
$message = stripslashes($message);
$phone = stripslashes($phone);

$rec_email = "AQUIVAMIDIRECCIONDECORREO"; // who do you want to send this email to
$subject = "CONTACTO WEB"; // this is the subject line of the email


$msg_body = "<html><head></head><body>";
$msg_body = "<font face=\"Verdana\" size=\"2\">";
$msg_body .= "<i>Message from <a href=\"$SERVER_NAME\">$SERVER_NAME</a></i><br>";
$msg_body .= "<hr width=\"100%\" size=\"1\" color=\"#333333\"><br>";

$msg_body .= "<b>Name:</b> $name<br>";
$msg_body .= "<b>E-Mail:</b> <a href=\"mailto:$email\">$email</a><br>";
$msg_body .= "<b>Comments:</b> $message<br>";
$msg_body .= "<b>Phone:</b> $phone<br>";

$msg_body .= "<hr width=\"100%\" size=\"1\" color=\"#333333\"><br>";
$msg_body .= "<br><br>";
$msg_body .= "<i>Additional Sender Information</i><br>";
$msg_body .= "<hr width=\"100%\" size=\"1\" color=\"#333333\"><br>";
$msg_body .= "<b>IP Address:</b> $REMOTE_ADDR<br>";
$HostName = gethostbyaddr($_SERVER['REMOTE_ADDR']);
$msg_body .= "<b>Host:</b> $HostName<br>";
$msg_body .= "<b>User Agent:</b> $HTTP_USER_AGENT<br>";
$msg_body .= "<hr width=\"100%\" size=\"1\" color=\"#333333\"><br>";
$msg_body .= "<font size=\"1\">email form provided by <a href=\"http://www.swish-tutorials.com\">Swish-Tutorials</a></font>";
$msg_body .= "</font></body></html>";

$header_info = "MIME-Version: 1.0\r\n";
$header_info .= "Content-type: text/html; charset=iso-8859-1\r\n";
$header_info .= "From: ".$name." <".$email.">";

mail($rec_email, $subject, $msg_body, $header_info);

?>

Alguien podría darme una pista¿? Intuyo que tendrá que ver con el uso de los divs dentro del formulario...

Gracias por adelantado