Foros del Web » Programando para Internet » PHP »

Dónde tengo el error?(formulario php)

Estas en el tema de Dónde tengo el error?(formulario php) en el foro de PHP en Foros del Web. Hola,tengo este formulario que me tiene loco.No logro de configurarlo bien,aver si me pueden aconsejar: El formulario en html : <form action="enviar.php" method="post" id="contact-form"> <div ...
  #1 (permalink)  
Antiguo 27/11/2010, 18:58
armandas
Invitado
 
Mensajes: n/a
Puntos:
Pregunta Dónde tengo el error?(formulario php)

Hola,tengo este formulario que me tiene loco.No logro de configurarlo bien,aver si me pueden aconsejar:

El formulario en html :

<form action="enviar.php" method="post" id="contact-form">
<div class="wrapper">
<label>
<input type="text" value="Your Name:" onblur="if(this.value=='') this.value='Your Name:'" onfocus="if(this.value =='Your Name:' ) this.value=''" />
</label>
<label>
<input type="text" value="Company:" onblur="if(this.value=='') this.value='Company:'" onfocus="if(this.value =='Company:' ) this.value=''" />
</label>
<label>
<input type="text" value="Telephone:" onblur="if(this.value=='') this.value='Telephone:'" onfocus="if(this.value =='Telephone:' ) this.value=''" />
</label>
<label>
<input type="text" value="E-mail:" onblur="if(this.value=='') this.value='E-mail:'" onfocus="if(this.value =='E-mail:' ) this.value=''" />
</label>
<strong>
<textarea cols="" rows="" onblur="if(this.value=='') this.value='MESSAGE:'" onfocus="if(this.value =='MESSAGE:' ) this.value=''" >MESSAGE:</textarea>
</strong>
<div class="clear"></div>
<i><a href="#" onclick="document.getElementById('contact-form').reset()">clear</a></i> <em><a href="#" onclick="document.getElementById('contact-form').submit()">send</a></em> </div>
</form>
</div>

Esto está bien?


El script enviar.php :

<?php
$destino="[email protected]";
$asunto="comentario";
$desde=$_POST[E-mail];
$comentario=$_POST[Mesagge];
mail($destino,$asunto,$desde,$comentario);
?>

No es demasiado corto?Que es lo que le falla?

Ya lei el wiki,de echo el video que tienen colgado me ayudo hacer el enviar.php.E visitados ya foros,y no encuentro solución a mi formulario...
Espero que me hecheis una mano,un saludo.
  #2 (permalink)  
Antiguo 27/11/2010, 19:17
Avatar de bocho0610  
Fecha de Ingreso: enero-2010
Ubicación: <? echo "Santiago, Chile"; ?>
Mensajes: 341
Antigüedad: 14 años, 3 meses
Puntos: 26
Respuesta: Dónde tengo el error?(formulario php)

te faltan los headers


Código PHP:
Ver original
  1. $destino="[email protected]";
  2. $asunto="comentario";
  3. $desde=$_POST[E-mail];
  4. $comentario=$_POST[Mesagge];
  5. $formato="html";
  6. $headers  = "From: TU NOMBRE <TU EMAIL> \r\n";
  7. $headers .= "Return-Path: <TU EMAIL> \r\n";
  8. $headers .= "Reply-To: TU EMAIL \r\n";
  9. $headers .= "X-Sender: TU EMAIL\r\n";
  10. $headers .= "X-Priority: 3 \r\n";
  11. $headers .= "MIME-Version: 1.0 \r\n";
  12. $headers .= "Content-Transfer-Encoding: 7bit \r\n";
  13.  
  14. if($formato == "html"){
  15. $headers .= "Content-Type: text/html; charset=iso-8859-1 \r\n";  
  16. }else{
  17. $headers .= "Content-Type: text/plain; charset=iso-8859-1 \r\n";}
  18.  
  19. @mail($desde, $asunto, $comentario, $headers)
__________________
Sigueme en Twitter!
Septimoarte.cl <-- Un mundo en cine.

Última edición por bocho0610; 27/11/2010 a las 19:22
  #3 (permalink)  
Antiguo 27/11/2010, 19:33
armandas
Invitado
 
Mensajes: n/a
Puntos:
Respuesta: Dónde tengo el error?(formulario php)

Cita:
Iniciado por bocho0610 Ver Mensaje
te faltan los headers


Código PHP:
Ver original
  1. $destino="[email protected]";
  2. $asunto="comentario";
  3. $desde=$_POST[E-mail];
  4. $comentario=$_POST[Mesagge];
  5. $formato="html";
  6. $headers  = "From: TU NOMBRE <TU EMAIL> \r\n";
  7. $headers .= "Return-Path: <TU EMAIL> \r\n";
  8. $headers .= "Reply-To: TU EMAIL \r\n";
  9. $headers .= "X-Sender: TU EMAIL\r\n";
  10. $headers .= "X-Priority: 3 \r\n";
  11. $headers .= "MIME-Version: 1.0 \r\n";
  12. $headers .= "Content-Transfer-Encoding: 7bit \r\n";
  13.  
  14. if($formato == "html"){
  15. $headers .= "Content-Type: text/html; charset=iso-8859-1 \r\n";  
  16. }else{
  17. $headers .= "Content-Type: text/plain; charset=iso-8859-1 \r\n";}
  18.  
  19. @mail($desde, $asunto, $comentario, $headers)
Gracias,dodne pone TU EMAIL ?? pongo mi email sinn mas?

Edito: he cambiado lo que has puesto,pero no me llegan los correos..puff

Última edición por armandas; 27/11/2010 a las 19:51
  #4 (permalink)  
Antiguo 27/11/2010, 19:51
Avatar de bocho0610  
Fecha de Ingreso: enero-2010
Ubicación: <? echo "Santiago, Chile"; ?>
Mensajes: 341
Antigüedad: 14 años, 3 meses
Puntos: 26
Respuesta: Dónde tengo el error?(formulario php)

Depende, el codigo lo tengo, ya que mi pagina manda el mail a los usuarios, como veo ahora en tu codigo, es el usuario el que te manda un mail a ti. Entonces en la parte donde va "TU MAIL" seria el email del usuario y tambien deberas cambiar:

Código PHP:
Ver original
  1. @mail($destino, $asunto, $comentario, $headers)
__________________
Sigueme en Twitter!
Septimoarte.cl <-- Un mundo en cine.
  #5 (permalink)  
Antiguo 27/11/2010, 20:01
armandas
Invitado
 
Mensajes: n/a
Puntos:
Respuesta: Dónde tengo el error?(formulario php)

Via email le mando el compando "$_POST[E-mail] \r\n" asi no?


los demas campos donde pone TU EMail igual,verdad?

Gracias,y perdona mi ignorancia
  #6 (permalink)  
Antiguo 27/11/2010, 20:16
Avatar de bocho0610  
Fecha de Ingreso: enero-2010
Ubicación: <? echo "Santiago, Chile"; ?>
Mensajes: 341
Antigüedad: 14 años, 3 meses
Puntos: 26
Respuesta: Dónde tengo el error?(formulario php)

Mira mejor Copia y pega xd

Código PHP:
Ver original
  1. $destino="[email protected]";
  2. $asunto="comentario";
  3. $desde=$_POST['E-mail'];
  4. $nombre_usuario= $_POST['nombre'];
  5. $comentario=$_POST['Mesagge'];
  6. $formato="html";
  7. $headers  = "From: ".$nombre_usurio." <".$desde."> \r\n";
  8. $headers .= "Return-Path: <".$desde."> \r\n";
  9. $headers .= "Reply-To: ".$desde." \r\n";
  10. $headers .= "X-Sender: ".$desde."\r\n";
  11. $headers .= "X-Priority: 3 \r\n";
  12. $headers .= "MIME-Version: 1.0 \r\n";
  13. $headers .= "Content-Transfer-Encoding: 7bit \r\n";
  14.  
  15. if($formato == "html"){
  16. $headers .= "Content-Type: text/html; charset=iso-8859-1 \r\n";  
  17. }else{
  18. $headers .= "Content-Type: text/plain; charset=iso-8859-1 \r\n";}
  19.  
  20. @mail($destino, $asunto, $comentario, $headers);
__________________
Sigueme en Twitter!
Septimoarte.cl <-- Un mundo en cine.
  #7 (permalink)  
Antiguo 27/11/2010, 20:26
armandas
Invitado
 
Mensajes: n/a
Puntos:
Respuesta: Dónde tengo el error?(formulario php)

Cita:
Iniciado por bocho0610 Ver Mensaje
Mira mejor Copia y pega xd

Código PHP:
Ver original
  1. $destino="[email protected]";
  2. $asunto="comentario";
  3. $desde=$_POST['E-mail'];
  4. $nombre_usuario= $_POST['nombre'];
  5. $comentario=$_POST['Mesagge'];
  6. $formato="html";
  7. $headers  = "From: ".$nombre_usurio." <".$desde."> \r\n";
  8. $headers .= "Return-Path: <".$desde."> \r\n";
  9. $headers .= "Reply-To: ".$desde." \r\n";
  10. $headers .= "X-Sender: ".$desde."\r\n";
  11. $headers .= "X-Priority: 3 \r\n";
  12. $headers .= "MIME-Version: 1.0 \r\n";
  13. $headers .= "Content-Transfer-Encoding: 7bit \r\n";
  14.  
  15. if($formato == "html"){
  16. $headers .= "Content-Type: text/html; charset=iso-8859-1 \r\n";  
  17. }else{
  18. $headers .= "Content-Type: text/plain; charset=iso-8859-1 \r\n";}
  19.  
  20. @mail($destino, $asunto, $comentario, $headers);
lo e copiado jajaja,ahora me llegan,pero me dice INVALID ADRESS@SYNTAX-ERROR.

luego al abirr el mensaje me sale en blanco...en fin xDD

Etiquetas: Ninguno
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 03:33.