Foros del Web » Creando para Internet » Herramientas y Software »

formularios de consulta en html y php; AYUDA!!!!

Estas en el tema de formularios de consulta en html y php; AYUDA!!!! en el foro de Herramientas y Software en Foros del Web. Hola gente , diseñe mi web y las consultas desde ella no me llegan al mail. acá les mando el código a ver si me ...
  #1 (permalink)  
Antiguo 22/11/2010, 15:34
 
Fecha de Ingreso: agosto-2010
Mensajes: 7
Antigüedad: 13 años, 8 meses
Puntos: 0
formularios de consulta en html y php; AYUDA!!!!

Hola gente , diseñe mi web y las consultas desde ella no me llegan al mail. acá les mando el código a ver si me pueden ayudar en detectar que esta mal, Gracias!!!!!!!!

form.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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>mi pagina web</title>
<style type="text/css">
<!--
.Estilo1 {
font-family: Georgia, "Times New Roman", Times, serif;
color: #333333;
}
.Estilo18 {
font-family: Georgia, "Times New Roman", Times, serif;
color: #7F005C;
}
.Estilo23 { color: #666666;
font-weight: bold;
}
.Estilo22 {color: #7F005C}
.Estilo24 {font-weight: bold; font-size: 18px; font-family: Georgia, "Times New Roman", Times, serif;}
.Estilo27 {font-weight: bold; font-size: 18px; font-family: Georgia, "Times New Roman", Times, serif; color: #7F005C; }
.Estilo21 {
color: #CCCCCC;
font-size: 16px;
font-family: Georgia, "Times New Roman", Times, serif;
font-weight: bold;
}
body {
margin-left: 0px;
margin-top: 0px;
}
.Estilo2 {font-family: Georgia, "Times New Roman", Times, serif}
-->
</style>
<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
</head>
<body>
<table width="884" border="0">
<tr>
<td colspan="2" bgcolor="7F005C">&nbsp;</td>
</tr>
<tr>
<td colspan="2" bgcolor="#CCCCCC"><div align="center"><span class="Estilo22"><span class="Estilo24">Contáctese</span></span><span class="Estilo27">/ Contact us</span></div></td>
</tr>
<tr>
<td width="439"><div align="center"><span class="Estilo27">[email protected]</span><br />
<span class="Estilo23">Cel: 156-000-0000<br />
Fax: (5411) 40000000 </span>
</p>
<br />
</div></td>
<td width="435"><div align="center"><span class="Estilo18">Atención telefónica de 10 AM a 6 PM</span></div></td>
</tr>
<tr>
<td colspan="2" bgcolor="#7F005C"><div align="center"><span class="Estilo21">O envíenos su consulta completando este formulario con su datos</span></div></td>
</tr>
<tr>
<td colspan="2" bgcolor="#7F005C"><div align="center"><span class="Estilo21">Or please write your message here </span></div></td>
</tr>
<tr>
<td colspan="2" bgcolor="#CCCCCC"><form action="mail.php" method="post">
<div align="center"><span class="Estilo1">nombre:</span>
<input type="text" name="name">
<br />
<br>
<span class="Estilo1"> e-mail :</span>
<input type="text" name = "email">
<br>
<br>
<span class="Estilo1">Consulta</span><br>
<textarea name="comments" cols="27" rows="8"></textarea>
<br>
<br>
<input name="Submit" type="submit" class="Estilo18" id="Submit" value="enviar" />
</div>
</form> </td>
</tr>
<tr>
<td colspan="2" bgcolor="7F005C">&nbsp;</td>
</tr>
</table>
</body>
</html>

mail.php
<?
function checkOK($field)
{
if (eregi("\r",$field) || eregi("\n",$field)){
die("Invalid Input!");
}
}
$name=$_POST['name'];
checkOK($name);
$email=$_POST['email'];
checkOK($email);
$comments=$_POST['comments'];
checkOK($comments);
$to="[email protected]";
$message="$name just filled in your comments form. They said:\n$comments\n\nTheir e-mail address was: $email";
if(mail($to,"Comments From mi pagina web",$message,"From: $email\n")) {
echo "Thanks for your comments, we`ll answer you soon. /
Gracias por enviarnos su consulta, a la brevedad le responderemos / Thank you, we´ll answer you soon";
} else {
echo "There was a problem sending the mail. Please check that you filled in the form correctly.";
}
?>
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>mi pagina web</title>
</head>
<body>
</body>
</body>
</html>
  #2 (permalink)  
Antiguo 24/11/2010, 17:00
Avatar de carlospc  
Fecha de Ingreso: noviembre-2008
Ubicación: Huancayo/Perú
Mensajes: 240
Antigüedad: 15 años, 5 meses
Puntos: 12
Respuesta: formularios de consulta en html y php; AYUDA!!!!

creooo... jeje... que tu error esta en la siguiente linea:

if(mail($to,"Comments From mi pagina web",$message,"From: $email\n"))

deberia ir asi:

if(mail($to,"Comments From mi pagina web",$message,"From: " . $email))


la estructura de la funcion mail es:

mail($destinatario, $asunto, $mensaje, $headers)


Otra cosa mas... no creo que en tu mensaje quieras leer $name o $email

Imagino quedras ver lo que contiene cada variable... esta linea:

$message="$name just filled in your comments form. They said:\n$comments\n\nTheir e-mail address was: $email";

Deberia ser asi...:

$message=$name . "just filled in your comments form. They said:\n$comments\n\nTheir e-mail address was: " . $email;

Si el problema persiste, nos informas...

si lo solucionas proporcionas un poco de karma...

Suerte...!!!
__________________
Mi web --> www.CarlosPC.net

Etiquetas: editores-web, html, php, formulario
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:30.