Código PHP:
<?php
set_locale(LC_ALL,"es_ES@euro","es_ES","esp");
echo strftime("%A %d de %B del %Y");
?>
Este es formulario.html
Código HTML:
<form id="form1" method="post" action="envia.php"> <p> </p> <p> </p> <table width="648" border="0" cellpadding="0" cellspacing="10"> <tr> <td class="Estilo3"><div class="Estilo2 Estilo3 ">Nombre del alegante:</div></td> <td colspan="2" class="Estilo3"><input name="Nombre" type="text" title="Ingrese su Nombre"id="Nombre" size="46"/></td> </tr> <tr> <td class="Estilo3"><div class="Estilo2 Estilo3 ">Localización de la finca (dirección o polígono y parcela o ref. catastral,...):</div></td> <td colspan="2"><input name="localizacion" type="text" title="Localización" id="localizacion" size="46"/></td> </tr> <tr> <td class="Estilo3"><div class="Estilo2 Estilo3 ">Alegación:</div></td> <td colspan="2"><input name="alegacion" type="text" title="Ingrese una alegación" id="alegacion" size="46"/></td> </tr> <tr> <td class="Estilo3"><div class="Estilo2 Estilo3 ">Fecha:</div></td> <td colspan="2"><input name="fecha" type="text" id="fecha" title="fecha" value=" " size="46"/></td> </input> </tr> <tr> <td class="Estilo3"><div class="Estilo2 Estilo3 ">Mensaje: </div></td> <td colspan="2"><textarea rows="5" name="mensaje" title="Ingrese su Mensaje" class="formu" cols="35"></textarea> </td> </tr> <tr> <td class="Estilo3"><div class="Estilo2 Estilo3 ">Número: </div></td> <td colspan="2"><textarea rows="1" name="numero" title="numero" class="formu" cols="8"></textarea> </tr> <tr> <td > </td> <td ><input class="submit" type="submit" value="Enviar" title="Enviar Formulario" name="Enviar" /> <input class="submit" type="reset" value="Borrar" title="Borrar Datos del Formulario" name="Borrar"/></td> </tr> </table> </form>
Código PHP:
<?php
$mensaje = $_POST['mensaje'];
$fecha = $_POST['fecha'];
$Nombre = $_POST['Nombre'];
$numero = $_POST['numero'];
$alegacion = $_POST['alegacion'];
$localizacion = $_POST['localizacion'];
//$Asunto = $_POST['Asunto'];
//E-mail en donde se recibirá el Formulario.
$recipiente = "direcciondecorreo";
//URL de tu Sitio Web.
$sw = "laurl";
//Mensaje que te llegará al Correo, con los datos ingresados.
$msg = "El Sr: $Nombre, envia el formulario con los siguientes datos:\n\n\n\n
Nombre: $Nombre
Fecha: $fecha
Numero: $numero
Alegación: $alegacion
Mensaje:
$mensaje\n\n";
//Comprobamos que los campos del formulario se encuentren completos.
if (empty($Nombre) || empty($email) || empty($alegacion) || empty($mensaje) || empty($localizacion)){
echo "<p align=center><font face=tahoma size=2><b><font color=#FF0000>Error:</font> No ha
introducido alguno de los campos requeridos, asegurese de rellenar todos los campos del formulario .</b><br><br><a href=$sw>Regresar al Home</a></font></p>";
}else{
//Limpiamos de posibles ataques.
$mensaje = ereg_replace("\r\n","<br>", $mensaje);
$Nombre = htmlentities($Nombre);
$numero = htmlentities($numero);
$alegacion = htmlentities($alegacion);
$mensaje = htmlentities($mensaje);
//Enviamos el E-mail con todos los datos.
mail("$recipiente", "Contacto Web", "$msg", "FROM: $email");
//Damos las gracias al visitante por contactarnos.
echo"<font face=tahoma size=2>
<p align=center>Señor <b>$Nombre</b>.
<p align=center>Su mensaje ha sido tramitado correctamente.<br>
</p>
<p align=center><br>
<a href=$sw>Regresar al Home</a>.</p>";
}
?>