HTML - Envio de formulario HTML a mi email.

 
Vista:

Envio de formulario HTML a mi email.

Publicado por ubaldo (1 intervención) el 04/04/2011 15:49:41
Buenas tarder, esrtoy realizando un formulario que será rellenados por distintos usuarios que entren en cierta web, bueno ek problema en cuestion es que nose como hacer enviar a un email de contacto las distintas respuestas de los usuarios que rellenen dicho formulario, os copio el codigo en html, uso Dreamweaver.

<!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" xml:lang="es-es" lang="es-es" dir="ltr" >



</head>

<body id="es-es">



<div id="page_margins">

<div id="page">



<!-- begin: #header -->

<div id="header">

<div id="topnav">

<!-- start: skip link navigation -->
</div>
</div>

<div id="main"><div id="col3"><div id="col3_content" class="clearfix"><div id="col3_content_wrapper" class="floatbox"><div class="floatbox">
<h2 class="contentheading">

Formulario para la solicitud de alojamiento </h2>

</div>

<p>

<script src="/js/fnObjetos.js" type="text/javascript"></script>

<script type="text/javascript">// <![CDATA[

jQuery(function() {

jQuery("#fechaNac").datepicker({ yearRange: '-100:+1', firstDay: 1, dayNamesMin: ['Do', 'Lu', 'Ma', 'Mi', 'Ju', 'Vi', 'Sa'], monthNames: ['Enero','Febrero','Marzo','Abril','Mayo','Junio','Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre'], dateFormat: 'dd/mm/yy' });

jQuery("#fechaSalida").datepicker({ yearRange: '-100:+1', firstDay: 1, dayNamesMin: ['Do', 'Lu', 'Ma', 'Mi', 'Ju', 'Vi', 'Sa'], monthNames: ['Enero','Febrero','Marzo','Abril','Mayo','Junio','Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre'], dateFormat: 'dd/mm/yy' });

jQuery("#fechaLlegada").datepicker({ yearRange: '-100:+1', firstDay: 1, dayNamesMin: ['Do', 'Lu', 'Ma', 'Mi', 'Ju', 'Vi', 'Sa'], monthNames: ['Enero','Febrero','Marzo','Abril','Mayo','Junio','Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre'], dateFormat: 'dd/mm/yy' });

});

// ]]></script>

<script type="text/javascript">// <![CDATA[

function fecha( cadena )

{

//Separador para la introduccion de las fechas

var separador = "/";



//Separa por dia, mes y año

if ( cadena.indexOf( separador ) != -1 )

{

var posi1 = 0;

var posi2 = cadena.indexOf( separador, posi1 + 1 );

var posi3 = cadena.indexOf( separador, posi2 + 1 );

this.dia = cadena.substring( posi1, posi2 );

this.mes = cadena.substring( posi2 + 1, posi3 );

this.anio = cadena.substring( posi3 + 1, cadena.length );

}

else

{

this.dia = 0;

this.mes = 0;

this.anio = 0;

}

}

function DiferenciaFechas (pFecha1,pFecha2)

{

//Obtiene dia, mes y año

var fecha1 = new fecha( pFecha1 );

var fecha2 = new fecha( pFecha2 );



//Obtiene objetos Date

var miFecha1 = new Date( fecha1.anio, fecha1.mes, fecha1.dia );

var miFecha2 = new Date( fecha2.anio, fecha2.mes, fecha2.dia );



//Resta fechas y redondea

var diferencia = miFecha1.getTime() - miFecha2.getTime();

var dias = Math.floor(diferencia / (1000 * 60 * 60 * 24));

//var segundos = Math.floor(diferencia / 1000)

//alert ('La diferencia es de ' + dias + ' dias,\no ' + segundos + ' segundos.')

if(dias<=0)

return false;

else

return true;

}

function HabilitarBoton()

{

var formulario = window.document.forms[1];

if(formulario.pLeido.checked==true)

formulario.pEnviar.disabled = false;

else

formulario.pEnviar.disabled = true;

}

function HabilitarPreferencias()

{

var formulario = window.document.forms[1];

if(formulario.pAlojamiento[1].checked==true)

{

formulario.molestaFumador[0].disabled = false;

formulario.molestaFumador[1].disabled = false;

formulario.convivirNinos[0].disabled = false;

formulario.convivirNinos[1].disabled = false;

formulario.convivirTerceraEdad[0].disabled = false;

formulario.convivirTerceraEdad[1].disabled = false;

formulario.esVegetariano[0].disabled = false;

formulario.esVegetariano[1].disabled = false;

formulario.convivirAnimales[0].disabled = false;

formulario.convivirAnimales[1].disabled = false;

} else {

formulario.molestaFumador[0].disabled = true;

formulario.molestaFumador[1].disabled = true;

formulario.convivirNinos[0].disabled = true;

formulario.convivirNinos[1].disabled = true;

formulario.convivirTerceraEdad[0].disabled = true;

formulario.convivirTerceraEdad[1].disabled = true;

formulario.esVegetariano[0].disabled = true;

formulario.esVegetariano[1].disabled = true;

formulario.convivirAnimales[0].disabled = true;

formulario.convivirAnimales[1].disabled = true;

}

}


function HabilitarCircunstancia(opcion)

{

var formulario = window.document.forms[1];

if(opcion==1)

formulario.EspecifiqueCircunstancia.disabled = false;

else if(opcion==2)

formulario.EspecifiqueCircunstancia.disabled = true;

}

function Validar()

{

var formulario = window.document.forms[1];

if(formulario.apellidos.value=="")

{

alert("Debes introducir tus apellidos");

formulario.apellidos.focus();

return false;

}

if(formulario.nombre.value=="")

{

alert("Debes introducir tu nombre");

formulario.nombre.focus();

return false;

}

if(formulario.fechaNac.value=="")

{

alert("Debes introducir la fecha de nacimiento");

formulario.fechaNac.focus();

return false;

}

if(formulario.pasaporte.value=="")

{

alert("Debes introducir tu pasaporte");

formulario.pasaporte.focus();

return false;

}

if(formulario.email.value=="")

{

alert("Debes introducir tu email");

formulario.email.focus();

return false;

}


if(formulario.fechaLlegada.value=="")

{

alert("Debes introducir la fecha de llegada");

formulario.fechaLlegada.focus();

return false;

}

if(formulario.fechaSalida.value=="")

{

alert("Debes introducir la fecha de salida");

formulario.fechaSalida.focus();

return false;

}

if(!DiferenciaFechas(formulario.fechaSalida.value,formulario.fechaLlegada.value))

{

alert("La fecha de salida debe ser posterior a la de llegada.");

formulario.fechaSalida.focus();

return false;

}

formulario.submit();

}

// ]]></script>
</p>

<table width="40%" border="1" cellpadding="6" cellspacing="0" style="width: 50%;">
<tbody>
<tr>
<td style="background-color:#018ac0;color:#FFFFFF" colspan="2">DATOS PERSONALES</td>
</tr>
<tr>
<td colspan="2">(*) CAMPOS OBLIGATORIOS</td>
</tr>
<tr>
<td width="30%">Apellidos (*):</td>
<td width="70%"><input maxlength="100" name="apellidos" size="45" /></td>
</tr>
<tr>
<td>Nombre (*):</td>
<td><input maxlength="100" name="nombre" size="45" /></td>
</tr>
<tr>
<td>Nacionalidad:</td>
<td><select name="nacionalidad">
<option></option>
<option value="AFG">AFGANISTÁN</option>
<option value="ALB">ALBANIA</option>
<option value="GER">ALEMANIA</option>
<option value="ANG">ANGOLA</option>
<option value="AND">ANDORRA</option>
<option value="ANT">ANTIGUA Y BARBUDA</option>
<option value="AHO">ANTILLAS HOLANDESAS</option>
<option value="KSA">ARABIA SAUDITA</option>
<option value="AL
.
.
.

</select></td>
</tr>
<tr>
<td>Sexo (*):</td>
<td>Hombre
<input name="sexo" type="radio" value="HOMBRE" />
Mujer
<input name="sexo" type="radio" value="MUJER" /></td>
</tr>
<tr>
<td>Fecha de nacimiento (*):</td>
<td><input id="fechaNac" name="pFechaNacimiento" readonly="readonly" size="10" type="text" /></td>
</tr>
<tr>
<td>Número de Pasaporte (*):</td>
<td><input maxlength="20" name="pasaporte" size="25" /></td>
</tr>
<tr>
<td>Dirección permanente:</td>
<td><input maxlength="100" name="direccion" size="45" /></td>
</tr>
<tr>
<td>Código Postal:</td>
<td><input maxlength="10" name="codigo" size="8" /></td>
</tr>
<tr>
<td>Ciudad:</td>
<td><input maxlength="100" name="ciudad" size="45" /></td>
</tr>
<tr>
<td>País:</td>
<td><input maxlength="100" name="pais" size="45" /></td>
</tr>
<tr>
<td>Teléfono:</td>
<td><input onkeypress="eliminaNoNumericos()" maxlength="20" name="telefono" size="20" /></td>
</tr>
<tr>
<td>Móvil:</td>
<td><input onkeypress="eliminaNoNumericos()" maxlength="20" name="movil" size="20" /></td>
</tr>
<tr>
<td>Fax:</td>
<td><input onkeypress="eliminaNoNumericos()" maxlength="20" name="fax" size="20" /></td>
</tr>
<tr>
<td>Email (*):</td>
<td><input maxlength="100" name="email" size="45" /></td>
</tr>
<tr>
<td colspan="2">Motivo de su estancia en la UA:<br />
<select class="textoWeb" name="motivoEstancia" size="1">
<option>Selecciona un motivo</option>
<option value="ESTUDIANTE DE CURSOS DE ESPAÑOL">ESTUDIANTE DE CURSOS DE ESPAÑOL</option>
<option value="ESTUDIANTE SOCRATES/ERASMUS">ESTUDIANTE SÓCRATES/ERASMUS</option>
<option value="ESTUDIANTE DE INTERCAMBIO UNIVERSITARIO">ESTUDIANTE DE INTERCAMBIO UNIVERSITARIO</option>
<option value="ESTUDIANTE DE MATRICULA EXTRAORDINARIA">ESTUDIANTE DE

</tr>
<tr>
<td>¿Solicita el certificado de alojamiento para obtener el visado?:</td>
<td>Sí
<input name="visado" type="radio" value="SI" />
No
<input name="visado" type="radio" value="NO" /></td>
</tr>
<tr>
<td colspan="2"><table style="width: 100%;" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td colspan="2">Indicar una persona de contacto en caso de emergencia:</td>
</tr>
<tr>
<td>Nombre:</td>
<td><input maxlength="100" name="nombrePersonaContacto" size="55" /></td>
</tr>
<tr>
<td>Teléfono:</td>
<td><input onkeypress="eliminaNoNumericos()" maxlength="20" name="telefonoPersonaContacto" size="20" /></td>
</tr>
<tr>
<td>Email:</td>
<td><input maxlength="100" name="emailPersonaContacto" size="55" /></td>
</tr>
</tbody>
</table></td>
</tr>
</tbody>
</table>
<form action="http://web.csidiomas.ua.es/Alojamiento/rformulario.asp" method="post">
<br />

<table style="width: 50%;" border="1" cellspacing="0" cellpadding="6">

<tbody>

<div style="text-align:center;"><br /> He leído y acepto las condiciones relativas a la <a href="/images/pdfs/lopd.pdf" target="_blank">Ley de Protección de Datos</a> <input onclick="HabilitarBoton()" name="pLeido" type="checkbox" /> <br /><br /><input onclick="return Validar();" disabled="disabled" name="pEnviar" type="button" value="Enviar" /></div>

</form>






</body>

</html>
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
Imágen de perfil de xve
Val: 1.144
Oro
Ha mantenido su posición en HTML (en relación al último mes)
Gráfica de HTML

Envio de formulario HTML a mi email.

Publicado por xve (1543 intervenciones) el 04/04/2011 23:44:30
Hola, puedes hacer dos cosas...

1.- te conectes con un servidor SMTP y realices desde ahí el envío, ya que si no pasa por un servidor SMTP, muchos de los programas antispam bloquearan dicho correo.
En la sección de código fuente de esta web podrás ver algunos códigos... este es uno de ellos: http://www.lawebdelprogramador.com/codigo/comentar.php?id=1884

2.- utilizando la instrucción mail() del php: http://php.net/manual/es/function.mail.php

Espero que te sirva
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar