Ver Mensaje Individual
  #6 (permalink)  
Antiguo 17/08/2007, 15:55
Avatar de urgido
urgido
 
Fecha de Ingreso: febrero-2005
Mensajes: 2.351
Antigüedad: 19 años, 2 meses
Puntos: 25
Re: Problema con formulario

Código PHP:
<? 
if (!isset($_POST['enviar'])){ 
?> 
<form action="<? $_SERVER['PHP_SELF']; ?>" method="post">
<h2>Datos personales</h2>
Nombre y Apellidos
<input type="text" name="nombre" maxlength="100" />
<br />
Fecha nacimento
<input type="text" name="edad" maxlength="100" /> 
<br />
D.N.I
<input type="text" name="dni" maxlength="100" /> 
<br />
Domicilio
<input type="text" name="domicilio" maxlength="100" />
<br />
Email
<input type="text" name="email" maxlength="100" />
<br />
Tel&eacute;fono
<input type="text" name="telf" maxlength="100" />

<h2>Datos profesionales</h2>
Formaci&oacute;n <br />
<textarea cols="40%" rows="5" name="formacion"></textarea>

Experiencia laboral<br />
<textarea cols="40%" rows="5" name="experiencia"></textarea>

Otros<br />
<textarea cols="40%" rows="5" name="otros"></textarea>

<input type="submit" value="Enviar" name="enviar" />
<input type="Reset" value="Borrar" />
</form>

<strong>Todos los campos son obligatorios</strong>
     <div style="clear:both"></div>
    </div>
     </div>

<? 
}else{
    
//Estoy recibiendo el formulario, compongo el cuerpo
    
$cuerpo .= "Formulario enviado\n";
    
$cuerpo .= "Nombre: " $_POST["nombre"] . "\n";
    
$cuerpo .= "Edad: " $_POST["edad"] . "\n";
    
$cuerpo .= "DNI: " $_POST["dni"] . "\n";
    
$cuerpo .= "Domicilio: " $_POST["domicilio"] . "\n";
    
$cuerpo .= "Email: " $_POST["email"] . "\n";
    
$cuerpo .= "Teléfono: " .$_POST["telf"] . "\n";
    
$cuerpo .= "Formación: " $_POST["formacion"] . "\n";
    
$cuerpo .= "Experiencia: " $_POST["experiencia"] . "\n";
    
$cuerpo .= "Otros: " $_POST["otros"] . "\n";

    
$headers .= "MIME-Version: 1.0\r\n"
    
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
    
$headers .= "From: Nombre Apellidos <[email protected]>\r\n";

$mail_env = @mail("[email protected]","Formulario enviado",$cuerpo,$headers);

if(
$mail_env){
 echo 
"Bien";
}else{
 echo 
"Mal";
}

    
//echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"0;URL=http://www.jmusicspain.com/sdp/trabajo.php\">";
}
?>
__________________
Hospedaje Web al mejor costo!