Ver Mensaje Individual
  #1 (permalink)  
Antiguo 30/03/2007, 07:55
moquehua
 
Fecha de Ingreso: agosto-2004
Mensajes: 113
Antigüedad: 19 años, 8 meses
Puntos: 0
formMail en la una misma pagina (2)

Hola, despues de ver este post:http://www.forosdelweb.com/f18/formmail-php-misma-pagina-465564/
y de intentar que mi formulario funcione recurro al foro.
Por un capricho, decidi que el formulario de contacto no tiene que abrirse en una ventana pop up ni estar en dos archivos separados (consulta.php y enviar.php) por más que funcione correctamente de esa manera.
Lo primero que intente fue:
Código PHP:
<?php
if($enviar){ @$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><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="enviar.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 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="Nombre2" 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="Email2" 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"></td>
                      </tr>
                    </table></td>
                </tr>
              </table>
            </form>}
?>
y deja de funcionar.


Entonces probe con esto
Código PHP:
 <?
if (!$HTTP_POST_VARS){
?> 
<form name="form1" method="post" action="enviar.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 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="Nombre2" 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="Email2" 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"></td>
                      </tr>
                    </table></td>
                </tr>
              </table>
            </form><?
}else{ 
@
$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><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);}
?>
y tampoco me funciona.
Donde esta el error? alguien me puede dar una mano?
Gracias