Hola, tengo un problema con este formulario, ya ue no llega ningún mensaje a la dirección descrita. Por que?
decir que es la primea cosa que hago en lenguage php.
Muchas Gracias de antemano.
Código PHP:
<?
if (!$HTTP_POST_VARS){
?>
<form action="encuesta.php" method=post>
<h2 style="margin-top:0px">Datos personales</h2>
Nombre y Apellidos
<input type="text" name="nombre" size="30" maxlength="100">
<br />
Edad
<input type="text" name="edad" size="30" maxlength="100">
<br />
Ciudad
<input type="text" name="ciudad" size="30" maxlength="100">
<br />
Email
<input type="text" name="email" size="25" maxlength="100">
<br />
<h2>Pregunta 1</h2><br />
<input type="radio" name="ciudadconcierto" value="1">Barcelona
<br>
<input type="radio" name="ciudadconcierto" value="2">Madrid
<br>
<h2>Pregunta 2</h2><br />
<input type="text" name="email" size="25" maxlength="100">
<h2>Pregunta 3</h2><br />
1.<input type="text" name="grupoprefe" size="30" maxlength="100"><br />
2.<input type="text" name="grupoprefe" size="30" maxlength="100"><br />
3.<input type="text" name="grupoprefe" size="30" maxlength="100"><br />
4.<input type="text" name="grupoprefe" size="30" maxlength="100"><br />
5.<input type="text" name="grupoprefe" size="30" maxlength="100"><br />
<h2>Pregunta 3</h2><br />
1.<input type="text" name="grupocd" size="30" maxlength="100"><br />
2.<input type="text" name="grupocd" size="30" maxlength="100"><br />
3.<input type="text" name="grupocd" size="30" maxlength="100"><br />
4.<input type="text" name="grupocd" size="30" maxlength="100"><br />
5.<input type="text" name="grupocd" size="30" maxlength="100"><br />
<h2>Pregunta 5.</h2><br />
<input type="text" name="preciocd" size="30" maxlength="100"><br />
Y por un dvd?<br />
<input type="text" name="preciodvd" size="30" maxlength="100"><br />
<h2>Pregunta 6.</h2><br />
<input type="text" name="conciertos" size="30" maxlength="100"><br />
<input type="submit" value="Enviar">
<input type="Reset" value="Borrar"><br />
<h4>Todos los campos son obligatorios</h4>
</form>
<?
}else{
//Estoy recibiendo el formulario, compongo el cuerpo
$cuerpo = "Formulario enviado\n";
$cuerpo .= "Nombre: " . $HTTP_POST_VARS["nombre"] . "\n";
$cuerpo .= "Edad: " . $HTTP_POST_VARS["edad"] . "\n";
$cuerpo .= "Ciudad: " . $HTTP_POST_VARS["ciudad"] . "\n";
$cuerpo .= "Email: " . $HTTP_POST_VARS["email"] . "\n";
$cuerpo .= "Ciudadparaconcierto: " . $HTTP_POST_VARS["ciudadconcierto"] . "\n";
$cuerpo .= "Grupospreferidos: " . $HTTP_POST_VARS["grupoprefe"] . "\n";
$cuerpo .= "Cddegrupos: " . $HTTP_POST_VARS["grupocd"] . "\n";
$cuerpo .= "Preciocd: " . $HTTP_POST_VARS["preciocd"] . "\n";
$cuerpo .= "Preciodvd: " . $HTTP_POST_VARS["preciodvd"] . "\n";
$cuerpo .= "Conciertos: " . $HTTP_POST_VARS["conciertos"] . "\n";
//mando el correo...
mail("[email protected]","Formulario recibido",$cuerpo);
//doy las gracias por el envío
echo "Gracias por participar en la encuesta";
}
?>