Foros del Web » Programando para Internet » PHP »

PHP OO Formulario RESPUESTA AUTOMATICA WRONG!

Estas en el tema de Formulario RESPUESTA AUTOMATICA WRONG! en el foro de PHP en Foros del Web. Buenas Buenas! por mas que le hecho coco no consigo donde esta el error! El formulario esta en html y lo envía a php, aquí ...
  #1 (permalink)  
Antiguo 19/01/2011, 23:56
Avatar de DanoRox  
Fecha de Ingreso: diciembre-2010
Ubicación: Maracay - Vzla
Mensajes: 19
Antigüedad: 13 años, 4 meses
Puntos: 2
Pregunta Formulario RESPUESTA AUTOMATICA WRONG!

Buenas Buenas! por mas que le hecho coco no consigo donde esta el error!
El formulario esta en html y lo envía a php, aquí yo puedo configurar una respuesta automática de la siguiente forma

$para = '[email protected]';
$asunto = $_POST['asunto'];
mail($para, $asunto, utf8_decode($mensaje), $header);
mail($mail, $asunto, utf8_decode($mensaje), $header2);

automáticamente me envía un correo con los datos del formulario y de igual manera le envía a la persona que lo llene.

Mi problema esta en que yo tengo configurada una respuesta automática en el correo '[email protected]' con Cpanel.

En cierto momento cuando llenabas el formulario me enviaba la información y salia automáticamente una respuesta al usuario. Ahora No lo hace, si alguien me dice por que o que hice que cambiara esa acción se lo agradecería mucho! les dejo el código para que echen un vistazo!

Código:
<?
$nombre = $_POST['nombre'];
$mail = $_POST['mail'];
$ciudad = $_POST['ciudad'];
$telefono = $_POST['telefono'];
$comentario = $_POST['mensaje'];
$asunto = $_POST['asunto'];
$yo = '[email protected]';

    if(isset($nombre) && !empty($nombre) &&
    isset($mail) && !empty($mail) &&
    isset($ciudad) && !empty($ciudad) &&
    isset($telefono) && !empty($telefono) &&
    isset($comentario) && !empty($comentario)) {

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

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

$mensaje = "Este mensaje fue enviado por " . $nombre . " \r\n";
$mensaje .= "De la ciudad de " . $ciudad . " \r\n";
$mensaje .= "Su numero es " . $telefono . " \r\n";
$mensaje .= "Su e-mail es: " . $mail . " \r\n";
$mensaje .= "Asunto: " . $asunto . " \r\n";
$mensaje .= "Mensaje: " . $comentario . " \r\n";
$mensaje .= "Enviado el " . date('d/m/Y', time());


$para = '[email protected]';
$asunto = $_POST['asunto'];
mail($para, $asunto, utf8_decode($mensaje), $header);
mail($mail, $asunto, utf8_decode($mensaje), $header2);

echo "<p> Mensaje enviado, tendras una respuesta lo mas pronto posible \n "; ?>
<script type="text/javascript">

var pagina = 'http://www.danorox.com/inicio.html';
var segundos = 180;

function redireccion() {

document.location.href=pagina;

}

setTimeout("redireccion()",segundos);

</script>
<?php
}else{ echo "<p>No has rellenado todos los campos</p>"; }
?>
Gracias de antemano!!!

DanoRox...
  #2 (permalink)  
Antiguo 20/01/2011, 00:32
 
Fecha de Ingreso: marzo-2008
Mensajes: 1.020
Antigüedad: 16 años, 1 mes
Puntos: 21
Respuesta: Formulario RESPUESTA AUTOMATICA WRONG!

Puedes poner tu formulario? Gracias.

No entiendo, has abierto php, no lo cerraste, abriste script, cerraste script y volviste a abrir php y lo cerraste.

Código PHP:
Ver original
  1. <?
  2. $nombre = $_POST['nombre'];
  3. $mail = $_POST['mail'];
  4. $ciudad = $_POST['ciudad'];
  5. $telefono = $_POST['telefono'];
  6. $comentario = $_POST['mensaje'];
  7. $asunto = $_POST['asunto'];
  8.  
  9.     if(isset($nombre) && !empty($nombre) &&
  10.     isset($mail) && !empty($mail) &&
  11.     isset($ciudad) && !empty($ciudad) &&
  12.     isset($telefono) && !empty($telefono) &&
  13.     isset($comentario) && !empty($comentario)) {
  14.  
  15. $header = 'From: ' . $mail . " \r\n";
  16. $header .= "X-Mailer: PHP/" . phpversion() . " \r\n";
  17. $header .= "Mime-Version: 1.0 \r\n";
  18. $header .= "Content-Type: text/plain";
  19.  
  20. $header2 = 'From: ' . $yo . " \r\n";
  21. $header2 .= "X-Mailer: PHP/" . phpversion() . " \r\n";
  22. $header2 .= "Mime-Version: 1.0 \r\n";
  23. $header2 .= "Content-Type: text/plain";
  24.  
  25. $mensaje = "Este mensaje fue enviado por " . $nombre . " \r\n";
  26. $mensaje .= "De la ciudad de " . $ciudad . " \r\n";
  27. $mensaje .= "Su numero es " . $telefono . " \r\n";
  28. $mensaje .= "Su e-mail es: " . $mail . " \r\n";
  29. $mensaje .= "Asunto: " . $asunto . " \r\n";
  30. $mensaje .= "Mensaje: " . $comentario . " \r\n";
  31. $mensaje .= "Enviado el " . date('d/m/Y', time());
  32.  
  33.  
  34. $asunto = $_POST['asunto'];
  35. mail($para, $asunto, utf8_decode($mensaje), $header);
  36. mail($mail, $asunto, utf8_decode($mensaje), $header2);
  37.  
  38. echo "<p> Mensaje enviado, tendras una respuesta lo mas pronto posible \n "; ?>
  39.  
  40. }else{ echo "<p>No has rellenado todos los campos</p>"; }
  41. ?>
  42.  
  43. <script type="text/javascript">
  44.  
  45. var pagina = 'http://www.danorox.com/inicio.html';
  46. var segundos = 180;
  47.  
  48. function redireccion() {
  49.  
  50. document.location.href=pagina;
  51.  
  52. }
  53.  
  54. setTimeout("redireccion()",segundos);
  55.  
  56. </script>

Prueba esto.
  #3 (permalink)  
Antiguo 20/01/2011, 05:02
Avatar de DanoRox  
Fecha de Ingreso: diciembre-2010
Ubicación: Maracay - Vzla
Mensajes: 19
Antigüedad: 13 años, 4 meses
Puntos: 2
Respuesta: Formulario RESPUESTA AUTOMATICA WRONG!

Abro php, lo cierro solo para poner el script de refresh, luego abro php otra ves coloco el else de lo datos incompletos, cierro php y VOILA...

Código HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>

<meta name="autor" content="DanoRox" />
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
<link rel="shortcut icon" href="favicon.ico" />
<title>DanoRox.::CONTACTO::.</title>
<link rel="stylesheet" href="dr.css" type="text/css" />
</head>
<body>
<div id="topi">
<object name="imFlash" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width= "1010" height= "180" >
<param name="movie" value="flash/top.swf" />
<param name="menu" value="false" />
<param name="quality" value="high" />
<param name="wmode" value="opaque" />
<!--[if !IE]> <-->
<object type="application/x-shockwave-flash" width="1010" height="180" data="flash/top.swf">
<param name="menu" value="false" />
<param name="quality" value="high" />
<param name="wmode" value="opaque" />
</object>
<!--> <![endif]-->
</object>
</div>
<!-- Navegacion -->
<div id="navi" class="box">
<a href="inicio.html"><img src="botones/inicio.png" alt="Inicio" class="btns" /></a> 
<a href="galeria.html"><img src="botones/galeria.png" alt="Galeria" class="btns" /></a> 
<a href="planes.html"><img src="botones/planes.png" alt="Planes" class="btns" /></a>
<a href="contacto.html"><img src="botones/contacto.png" alt="Contacto" class="btns" /></a>
</div>
<!-- Back -->
<p> </p>
<!-- Wrapers -->
<div id="box1" class="box">
<p><a href="galeria.html"><img src="botones/galeriar.png" alt="" title="" /></a></p>
<p>Algunos de nuestros productos:</p>
<p>Mug<img src="img/img1.png" alt="" title="" /></a></p>
<p>Gorras<img src="img/img2.png" alt="" title="" /></a></p>
<p>Digitalizado<img src="img/img3.png" alt="" title="" /></a></p>
<p>Bordados<img src="img/img4.png" alt="" title="" /></p>
</div>
<div id="box4" class="box">
<h1>CONTACTO</h1> 
<div align="center">
<?php
$nombre = $_POST['nombre'];
$mail = $_POST['mail'];
$ciudad = $_POST['ciudad'];
$telefono = $_POST['telefono'];
$comentario = $_POST['mensaje'];
$asunto = $_POST['asunto'];
$yo = '[email protected]';

    if(isset($nombre) && !empty($nombre) &&
    isset($mail) && !empty($mail) &&
    isset($ciudad) && !empty($ciudad) &&
    isset($telefono) && !empty($telefono) &&
    isset($comentario) && !empty($comentario)) {

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

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

$mensaje = "Este mensaje fue enviado por " . $nombre . " \r\n";
$mensaje .= "De la ciudad de " . $ciudad . " \r\n";
$mensaje .= "Su numero es " . $telefono . " \r\n";
$mensaje .= "Su e-mail es: " . $mail . " \r\n";
$mensaje .= "Asunto: " . $asunto . " \r\n";
$mensaje .= "Mensaje: " . $comentario . " \r\n";
$mensaje .= "Enviado el " . date('d/m/Y', time());


$para = '[email protected]';
$asunto = $_POST['asunto'];
mail($para, $asunto, utf8_decode($mensaje), $header);
echo "<p> Mensaje enviado, tendras una respuesta lo mas pronto posible \n ";
?>
<script type="text/javascript">

var pagina = 'http://www.danorox.com/inicio.html';
var segundos = 90;

function redireccion() {

document.location.href=pagina;

}

setTimeout("redireccion()",segundos);

</script>
<?php
}else{ echo "<p>No has rellenado todos los campos</p>"; }
?>
</div>
</div>


<!-- Footer -->
<div id="footer">
<p><a href="contacto.html"><img src="img/cbd.gif" class="btns" alt="CreatedByDanoRox" /></a> <a href="http://validator.w3.org/check?uri=referer"><img class="btns" src="http://www.w3.org/Icons/valid-xhtml10" alt="XHTML 1.0 Strict Valido!" /></a> <a href="http://jigsaw.w3.org/css-validator/check/referer"><img src="http://jigsaw.w3.org/css-validator/images/vcss-blue" class="btns" alt="CSS Valido!" /></a></p>
</div>
</body>
</html> 
Y el fomulario es este:

Código HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta name="autor" content="DanoRox" />
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
<link rel="shortcut icon" href="favicon.ico" />
<title>DanoRox.::CONTACTO::.</title>
<link rel="stylesheet" href="dr.css" type="text/css" />
</head>
<body>
<div id="topi">
<object name="imFlash" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width= "1010" height= "180" >
<param name="movie" value="flash/top.swf" />
<param name="menu" value="false" />
<param name="quality" value="high" />
<param name="wmode" value="opaque" />
<!--[if !IE]> <-->
<object type="application/x-shockwave-flash" width="1010" height="180" data="flash/top.swf">
<param name="menu" value="false" />
<param name="quality" value="high" />
<param name="wmode" value="opaque" />
</object>
<!--> <![endif]-->
</object>
</div>
<!-- Navegacion -->
<div id="navi" class="box">
<a href="inicio.html"><img src="botones/inicio.png" alt="Inicio" class="btns" /></a> 
<a href="galeria.html"><img src="botones/galeria.png" alt="Galeria" class="btns" /></a> 
<a href="planes.html"><img src="botones/planes.png" alt="Planes" class="btns" /></a>
<a href="contacto.html"><img src="botones/contacto.png" alt="Contacto" class="btns" /></a>
</div>
<!-- Back -->
<p> </p>
<!-- Wrapers -->
<div id="box1" class="box">
<p><a href="galeria.html"><img src="botones/galeriar.png" alt="" title="" /></a></p>
<p>Algunos de nuestros productos:</p>
<p>Mug<img src="img/img1.png" alt="" title="" /></a></p>
<p>Gorras<img src="img/img2.png" alt="" title="" /></a></p>
<p>Digitalizado<img src="img/img3.png" alt="" title="" /></a></p>
<p>Bordados<img src="img/img4.png" alt="" title="" /></p>
</div>
<div id="box4" class="box">
<h1>CONTACTO</h1>
<form id="form1" name="form1" method="post" action="enviar.php"> 
<div align="center"> 
<table width="320" border="0" cellspacing="5" cellpadding="5"> 
<tr> 
<td width="54">Nombre:</td>
<td width="266"><div align="center"> 
<input type="text" name="nombre" id="nombre" /> 
</div></td> 
</tr> 
<tr> 
<td>Ciudad:</td>
<td><div align="center"> 
<input type="text" name="ciudad" id="ciudad" /> 
</div></td> 
</tr> 
<tr> 
<td>e-mail:</td> 
<td><div align="center"> 
<input type="text" name="mail" id="mail" /> 
</div></td> 
</tr>
<td>Telf:</td>
<td><div align="center"> 
<input type="text" name="telefono" id="telefono" />
</div></td> 
</tr>  
<tr> 
<td>Asunto:</td> 
<td><div align="center"> 
<label> 
<select name="asunto" id="asunto"> 
<option>Info</option> 
<option>Sugerencia</option> 
<option>Comentarios</option> 
</select> 
</label> 
</div></td> 
</tr> 
<tr> 
<td valign="top">Mensaje:</td> 
<td><textarea name="mensaje" id="mensaje" cols="30" rows="5"></textarea></td> 
</tr> 
<tr> 
<td colspan="2"><div align="center"> 
<input type="submit" name="enviar" id="enviar" value="Enviar" />
<input type="reset" name="borrar" value="Borrar" id="borrar" /> 
</div></td> 
</tr> 
</table> 
</div>
</div>


<!-- Footer -->
<div id="footer">
<p><a href="contacto.html"><img src="img/cbd.gif" class="btns" alt="CreatedByDanoRox" /></a> <a href="http://validator.w3.org/check?uri=referer"><img class="btns" src="http://www.w3.org/Icons/valid-xhtml10" alt="XHTML 1.0 Strict Valido!" /></a> <a href="http://jigsaw.w3.org/css-validator/check/referer"><img src="http://jigsaw.w3.org/css-validator/images/vcss-blue" class="btns" alt="CSS Valido!" /></a></p>
</div>
</body>
</html> 
Agradezco a quien pueda ayudarme!!!

Atte. DanoRox
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 22:38.