Problemas con formulario
Publicado por Leonardo (3 intervenciones) el 25/07/2012 12:18:00
Tengo un problema, me fijo si el hosting soporta PHP y si lo hace, entonces el error esta en el codigo no se exactamente donde asi que recurro a ustedes para que quizas me muestren el error.
Codigo HTML
Codigo PHP
Por favor si alguien me puede ayudar, muchas gracias
Codigo HTML
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<div id="apDiv49">
<form id="form1" name="form1" method="post" action="enviar.php">
<label>
<input name="nombre" type="text" id="nombre" size="30" maxlength="16" />
</label>
<label>
<input name="email" type="text" id="email" size="30" />
</label>
<label>
<input name="asunto" type="text" id="asunto" size="30" maxlength="16" />
</label>
<label>
<textarea name="consulta" id="consulta" cols="24" rows="4"></textarea>
</label>
<br />
<label>
<input type="submit" name="enviar" id="enviar" value="Enviar" />
</label>
<label>
<input type="reset" name="borrar" id="borrar" value="Borrar" />
</label>
</form>
</div>
Codigo PHP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<!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=iso-8859-1" />
<title>Enviar Mail</title>
</head>
<body>
<?
if(isset($_POST['Submit']))
{
// Direccion de email del usuario al que quieren que le llegue el mail.
$email = "leobravo90@gmail.com.ar";
// Subject del mail que le llega al usuario final.
$subject = "Envio de mail vía Web";
// En esta variable se va agregando todo el código necesario para armar el mensaje.
$mensaje = $_POST['nombre']." escribio el siguiente comentario:\n";
$mensaje .= "-----------------------------------------------------------------------------\n";
$mensaje .= $_POST['direccion']."\n";
$mensaje .= "-----------------------------------------------------------------------------\n";
$mensaje .= $_POST['localidad']."\n";
$mensaje .= "-----------------------------------------------------------------------------\n";
$mensaje .= $_POST['pais']."\n";
$mensaje .= "-----------------------------------------------------------------------------\n";
$mensaje .= $_POST['telefono']."\n";
$mensaje .= "-----------------------------------------------------------------------------\n";
$mensaje .= $_POST['email']."\n";
$mensaje .= "-----------------------------------------------------------------------------\n";
$mensaje .= $_POST['sexo']."\n";
$mensaje .= "-----------------------------------------------------------------------------\n";
$mensaje .= $_POST['informacion']."\n";
$mensaje .= "-----------------------------------------------------------------------------\n";
$mensaje .= $_POST['consulta']."\n";
$mensaje .= "-----------------------------------------------------------------------------\n";
/*
Se puede agregar contenido al encabezado del mensaje. Este puede tener la siguiente forma:
1.From: remitente@dominio.com\r\n
2.To: destino@dominio.com\r\n
3.CC: copia@dominio.com\r\n
4.BCC: copiaoculta@dominio.com\r\n
5.Reply-To: repondera@dominio.com\r\n
*/
$headers = "From: leobravo90@gmail.com.ar\r\n";
$headers .= "X-Mailer: PHP/\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/plain; charset=iso-8859-1\r\n";
if(mail($email, $subject, $mensaje, $headers))
{
echo("<p>Mail Enviado Correctamente</p>");
}else
{
echo("<p>Error al Enviar el Mail</p>");
}
}else
{
header( "HTTP/1.1 301 Moved Permanently" );
header( "Status: 301 Moved Permanently" );
header( "Location: http://www.technoorigins.site50.net/contacto.html" );
exit(0);
}
?>
</body>
</html>
Por favor si alguien me puede ayudar, muchas gracias
Valora esta pregunta


0