85 lines
3.0 KiB
PHP
85 lines
3.0 KiB
PHP
<!DOCTYPE html>
|
|
<html lang="en">
|
|
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Ejercicio Aseguradora</title>
|
|
</head>
|
|
|
|
<body>
|
|
<form action="" method="POST">
|
|
<label for="nombre">Nombre completo:</label><br>
|
|
<input type="text" id="nombre" name="nombre" required><br><br>
|
|
|
|
<label for="email">Correo electrónico:</label><br>
|
|
<input type="email" id="email" name="email" required><br><br>
|
|
|
|
<label for="telefono">Teléfono:</label><br>
|
|
<input type="tel" id="telefono" name="telefono"><br><br>
|
|
|
|
<label for="marca">Marca del coche:</label><br>
|
|
<input type="text" id="marca" name="marca" required><br><br>
|
|
|
|
<label for="modelo">Modelo del coche:</label><br>
|
|
<input type="text" id="modelo" name="modelo" required><br><br>
|
|
|
|
<label for="anio">Año del coche:</label><br>
|
|
<input type="number" id="anio" name="anio" min="1900" max="2099" required><br><br>
|
|
|
|
<label for="matricula">Matricula:</label><br>
|
|
<input type="text" id="matricula" name="matricula" required><br><br>
|
|
|
|
<label for="tipo_seguro">Tipo de seguro:</label><br>
|
|
<select id="tipo_seguro" name="tipo_seguro" required>
|
|
<option value="">Selecciona el tipo de seguro</option>
|
|
<option value="Terceros">Terceros</option>
|
|
<option value="Terceros Ampliado">Terceros Ampliado</option>
|
|
<option value="Todo Riesgo">Todo Riesgo</option>
|
|
</select><br><br>
|
|
|
|
<label for="comentarios">Comentarios:</label><br>
|
|
<textarea id="comentarios" name="comentarios" rows="4" cols="50"></textarea><br><br>
|
|
|
|
<input type="submit" value="Enviar">
|
|
</form>
|
|
|
|
<?php
|
|
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|
$nombre = $_POST['nombre'];
|
|
$email = $_POST['email'];
|
|
$telefono = $_POST['telefono'];
|
|
$marca = $_POST['marca'];
|
|
$modelo = $_POST['modelo'];
|
|
$anio = $_POST['anio'];
|
|
$matricula = $_POST['matricula'];
|
|
$tipoSeguro = $_POST['tipo_seguro'];
|
|
$comentarios = $_POST['comentarios'];
|
|
|
|
|
|
$emailText = 'Detalles del seguro de coche \r\n';
|
|
$emailText .= "Nombre: $nombre \r\n";
|
|
$emailText .= "Email: $email \r\n";
|
|
$emailText .= "Telefono: $telefono \r\n";
|
|
$emailText .= "Marca: $marca \r\n";
|
|
$emailText .= "Modelo: $modelo \r\n";
|
|
$emailText .= "Año: $anio \r\n";
|
|
$emailText .= "Matricula: $matricula \r\n";
|
|
$emailText .= "Tipo seguro: $tipoSeguro \r\n";
|
|
$emailText .= "Comentarios: $comentarios \r\n";
|
|
|
|
|
|
$destinatario = "appasin04@gmail.com";
|
|
$asunto = "Solicitud informacion seguro";
|
|
$headers = 'Reply-To: appasin04@gmail.com' . "\r\n";
|
|
if (mail($destinatario, $asunto, $emailText, $headers)) {
|
|
echo "Correo enviado";
|
|
} else {
|
|
echo "No se ha podido enviar el correo";
|
|
}
|
|
}
|
|
?>
|
|
|
|
</body>
|
|
|
|
</html>
|