Ver Mensaje Individual
  #5 (permalink)  
Antiguo 31/03/2007, 21:36
El Patrón.
 
Fecha de Ingreso: abril-2006
Ubicación: Colombia
Mensajes: 648
Antigüedad: 18 años
Puntos: 3
Re: formMail en la una misma pagina (2)

Hola

Bueno, pues tienes 2 problemas

1. el form lo estas cerrando despues de los tables, y debes es cerrarlo despues del input type submit

2. la variable $Enviar no tiene nada puesto que no tienes una variable llamada asi en el formulario y cuando te dije $Enviar cometi el error de decirte que usaras $Enviar en vez de $Submit, pues el boton se llama Submit y tiene el valor enviar, y cuando lo mandas por post quedaria es $Submit = "Enviar"; entonces cambia en el if $Enviar por $Submit, y ya te debe con esos cambios funcionar perfecto desde que incluyas en algun lado la conexion a la bd pues tienes mysql_query pero no veo el mysql_connect que tal vez lo tengas en un archivo aparte y lo llamas con un include o no pusiste ese codigo, pero como te digo te debe ya funcionar bien, sin embargo te pongo el codigo corregido

<?php
if($Submit){
@$Nombre = $_POST['Nombre'];
@$Email = $_POST['Email'];
@$Consulta = $_POST['Consulta'];
@$telefono = $_POST['telefono'];
@$inmob = $_POST['in'];
mysql_query("update clientes set consultas=consultas+1 where clid='$inmob'");

$result = mysql_query("select vid from visitantes where mail = '$Email'");
$results = mysql_num_rows($result);
if ($results>0) {
mysql_query("update visitantes set contactos=contactos+1 where mail='$Email'");
} else {
mysql_query("insert into visitantes values (NULL, '$Nombre', '$Email', 1)");
}
$result = mysql_query("select mail from clientes where clid = '$inmob'");
list($receptor) = mysql_fetch_array($result);

//************************************************** **********************/
$header = "From: $Nombre <$Email>\n";
$header .= "To: ".$receptor."\n";
$header .= "X-Mailer: PHP4\n"; //mailer
$header .= "MIME-Version: 1.0\n";
$header .= "Reply-to: ".$Email."\n";
$header .= "Content-type: text/html; charset=iso-8859-1\n";
//************************************************** **********************/

$cuerpo = "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>
<html><head>
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>
</head>
<body>
<tr>
<td bgcolor='#fea941' align='left' valign='top'>" . $Nombre . " env&iacute;a una consulta desde misitio.com.ar
<br>Nombre: " . $Nombre . "
<br>Email: <a href='mailto: " . $Email . "'> " . $Email . "</a>
<br>Tel&eacute;fono: " . $telefono . "
<br>Consulta: " . $Consulta . "
</td></tr></body></html>";
mail($receptor,'Visitante de misitio.com.ar',$cuerpo,$header);
}
else{ ?> <form name="form1" method="post" action="prueba.php" onSubmit="MM_validateForm('Nombre','','R','Email', '','RisEmail','consulta','','R');return document.MM_returnValue">
<table width="280" height="250" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="left" valign="top">
<table width="100%" height="20" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="left" valign="middle" bgcolor="#FEA941" class="fecha">Consulta
para <strong><?php echo $receptor1; ?></strong></td>
</tr>
</table>
<table width="250" height="0" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="271" align="left" valign="top" class="texto2"><input name="in" type="hidden" value="<?php $clid=1; echo $clid; ?>">
</td>
</tr>
</table>
<table width="250" height="20" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="left" valign="middle" class="opcion">Nombre<br>
<input name="Nombre" type="text" id="Nombre" size="40" style="width:240px" class="formularios"></td>
</tr>
</table>
<table width="250" height="20" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="240" align="left" valign="middle" class="opcion">E-mail<br>
<input name="Email" type="text" id="Email" size="40" style="width:240px" class="formularios"></td>
</tr>
<tr>
<td width="240" align="left" valign="middle" class="opcion">Tel&eacute;fono<br>
<input name="telefono" type="text" id="telefono" size="40" style="width:240px" class="formularios"></td>
</tr>
</table>
<table width="250" height="60" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="left" valign="middle" class="opcion">Consulta<br>
<textarea name="Consulta" cols="40" rows="5" id="textarea" style="width:240px" class="formularios"></textarea></td>
</tr>
</table>
<table width="250" height="20" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><input type="submit" name="Submit" value="Enviar" class="bt-form">
<input type="reset" name="Submit2" value="Borrar" class="bt-form">
</form>
</td>
</tr>
</table></td>
</tr>
</table>
<? }
?>

Ha, y me tome el atrevimiento de agregarte el campo del telefono, si quieres almacenarlo entonces este campo debe estar tambien en la tabla de visitantes y en el insert into le agregas esa variable, o si no pues quita lo que te puse y listo, espero ya ahora si te funcione.
__________________
Suerte.
_______________________________
"La vida es el principio de la muerte".