Hola, gracias de nuevo, pero el fomrulario no se envia, y no se por que?
Código PHP:
<?
if (!$_POST){
?>
<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>
<input type="radio" name="ciudadconcierto" value="1">Barcelona
<br>
<input type="radio" name="ciudadconcierto" value="2">Madrid
<br>
<h2>Pregunta 2</h2>
<input type="text" name="email" size="25" maxlength="100">
<h2>Pregunta 3</h2>
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>
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>
<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>
<input type="text" name="conciertos" size="30" maxlength="100"><br />
<input type="submit" value="Enviar">
<input type="Reset" value="Borrar"><br />
<h4>Toso los campos son obligatorios</h4>
<h4>En caso de consultas, propuestas, etc. contactar con: [email protected]</h4>
</form>
<?
}else{
//Estoy recibiendo el formulario, compongo el cuerpo
$cuerpo = "Formulario enviado\n";
$cuerpo .= "Nombre: " . $_POST['nombre'] . "\n";
$cuerpo .= "Edad: " . $_POST['edad'] . "\n";
$cuerpo .= "Ciudad: " . $_POST['ciudad'] . "\n";
$cuerpo .= "Email: " . $_POST['email'] . "\n";
$cuerpo .= "Ciudadparaconcierto: " . $_POST['ciudadconcierto'] . "\n";
$cuerpo .= "Grupospreferidos: " . $_POST['grupoprefe'] . "\n";
$cuerpo .= "Cddegrupos: " . $_POST['grupocd'] . "\n";
$cuerpo .= "Preciocd: " . $_POST['preciocd'] . "\n";
$cuerpo .= "Preciodvd: " . $_POST['preciodvd'] . "\n";
$cuerpo .= "Conciertos: " . $_POST['conciertos'] . "\n";
$headers .= "From: Encuesta <[email protected]>\r\n";
$headers .= "Reply-To: [email protected]\r\n";
mail("[email protected]","Formulario recibido",$cuerpo, $headers);
//doy las gracias por el envío
echo "Gracias por participar en la encuesta";
}
?>
He provado también añadiendo un punto después del primer headers ($headers .=) ya que no sabia si el ejemplo que me habias dado era a si o faltava el punto.
Gracias de antemano.