Ver Mensaje Individual
  #1 (permalink)  
Antiguo 22/02/2013, 21:51
pabloem1972
 
Fecha de Ingreso: noviembre-2010
Mensajes: 48
Antigüedad: 13 años, 5 meses
Puntos: 1
Formulario con php

HOLA ESTOY HACIENDO UNA WEB CON UN FORMULARIO CON VALIDACION Y UN ARCHIVO PHP PARA ENVIAR EL RESULTADO DEL FORMULARIO A UN EMAIL.
TODO VA BIEN EL FORMULARIO ANDA PERFECTO LA VALIDACION TAMBIEN Y SE ENVIAN LOS EMAILS. EL UNICO TEMA ES QUE EN LOS EMAILS NO LLEGA LA INFORMACION QUE INGRESA LA PERSONA QUE LLENA EL FORMULARIO (LLEGAN LOS EMAILS PERO FALTA LA INFORMACION QUE INGRESA EL VISITANTE).


LES ENVIO EL CODIGO DEL FORMULARIO QUE ESTA EN EL HTML:

<form action="php/quickcontact.php" method="post" id="contactwidget">
<div class="inp_l">
<div class="inp_r"><input type="text" name="wname" id="wname" value="Nombre" size="22" tabindex="11" alt="Nombre" /></div>
</div>

<div class="inp_l">
<div class="inp_r"><input type="text" name="wemail" id="wemail" value="Email" size="22" tabindex="12" alt="Email" /></div>
</div>
<table>
<tr>
<td class="text_t_l"></td>
<td class="text_t"></td>
<td class="text_t_r"></td>
</tr>
<tr>
<td class="text_l"></td>
<td class="text_m"><textarea name="wmessage" id="wmessage" cols="28" rows="6" tabindex="13" title="Mensaje">Mensaje</textarea></td>
<td class="text_r"></td>
</tr>
<tr>
<td class="text_b_l"></td>
<td class="text_b"></td>
<td class="text_b_r"></td>
</tr>
</table>
<div class="loading"></div>
<div><input type="hidden" name="wcontactemail" id="wcontactemail" value="[email protected]" /></div>
<div><input type="hidden" name="wcontacturl" id="wcontacturl" value="php/quickcontact.php" /></div>
<div><a href="php/quickcontact.php" id="wformsend" class="button" tabindex="14"><span>Enviar</span></a></div>
</form>


Y EL DEL ARCHIVO PHP DE ENVIO:

<?php
if ((isset($_POST['wname'])) && (strlen(trim($_POST['wname'])) > 0)) {
$contact_name = stripslashes(strip_tags($_POST['wname']));
} else {$contact_name = 'No contact name entered';}
if ((isset($_POST['wemail'])) && (strlen(trim($_POST['wemail'])) > 0)) {
$contact_email = stripslashes(strip_tags($_POST['wemail']));
} else {$contact_email = 'No email entered';}
if ((isset($_POST['wmessage'])) && (strlen(trim($_POST['wmessage'])) > 0)) {
$contact_message = stripslashes(strip_tags($_POST['wmessage']));
} else {$contact_message = 'No message entered';}
ob_start();
?>
<html>
<head>
<style type="text/css">
</style>
</head>
<body>
<table width="550" border="1" cellspacing="2" cellpadding="2">
<tr bgcolor="#eeffee">
<td>Name</td>
<td><?=$wname;?></td>
</tr>
<tr bgcolor="#eeeeff">
<td>Email</td>
<td><?=$wemail;?></td>
</tr>
<tr bgcolor="#eeeeff">
<td>Message</td>
<td><?=$wmessage;?></td>
</tr>
</table>
</body>
</html>
<?
$body = ob_get_contents();

$to = '[email protected]';
$email = '[email protected]';
$fromaddress = "[email protected]";
$fromname = "Online Contact";

require("phpmailer.php");

$mail = new PHPMailer();

$mail->From = "[email protected]";
$mail->FromName = "Contacto";
$mail->AddAddress("[email protected]","Pablo"); //change to your email address

$mail->WordWrap = 50;
$mail->IsHTML(true);

$mail->Subject = "Quickcontact: Mensaje recibido";
$mail->Body = $body;
$mail->AltBody = "This is the text-only body";

if(!$mail->Send()) {
$recipient = '[email protected]'; //change to your email address
$subject = 'contactwidget failed';
$content = $body;
mail($recipient, $subject, $content, "From: [email protected]\r\nReply-To: $email\r\nX-Mailer: DT_formmail");
exit;
}
?>

EL FORMULARIO SE ENVIA PERFECTO LLEGA EL EMAIL PERFECTO. TAMBIEN LLEGA EN EL CUERPO DEL MENSAJE LA TABLA ESPECIFICADA EN EL ARCHIVO PHP PERO EN ESTA TABLA NO SE VEN LOS DATOS QUE ESCRIBE EL VISITANTE. ES DECIR EN EL MENSAJE RECIBIDO SE VE:

Name:
Email:
Message:

PERO NO SE CARGAN LOS DATOS INGRESADOS AL LLENAR EL FORMULARIO. SUPONGO QUE DEBE HABER UN ERROR DE RELACION ENTRE LAS ETIQUETAS DEL FORMULARIO Y LAS DEL ARCHIVO PHP PARA QUE ESTE CARGUE LA INFORMACION.

NO SE MUCHO DE PHP LES AGRADECERIA MUCHO SU AYUDA. DESDE YA MUCHAS GRACIAS