HTMl:
Código:
PHP:<!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"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>CONTACTO</title> <link href="estilo-pagina-css.php" rel="stylesheet" type="text/css" /> <link href="estilo.css" rel="stylesheet" type="text/css" /> <style type="text/css"> </style> </head> <body> <div id="izquierda-c"> <section class="formulario"> <form action="contacto/formulario/contacto.php" method="post"> <label for="nombre"><span class="titulo-formulario">Formulario de contacto <br /> <br /> </span> Nombre:</label> <input id="nombre" type="text" name="nombre" placeholder="Nombre y Apellido" required="" /> <label for="email">Email:</label> <input id="email" type="email" name="email" placeholder="[email protected]" required="" /> <label for="mensaje">Mensaje:</label> <textarea id="mensaje" name="mensaje" placeholder="Mensaje" required=""></textarea> <input id="submit" type="submit" name="submit" value="Enviar" /> </form> </section> </div> </body> </html>
Código:
CSS:<?php $nombre = $_POST['nombre']; $email = $_POST['email']; $mensaje = $_POST['mensaje']; $para = '[email protected]'; $titulo = 'ASUNTO DEL MENSAJE'; $header = 'From: ' . $email; $msjCorreo = "Nombre: $nombre\n E-Mail: $email\n Mensaje:\n $mensaje"; if ($_POST['submit']) { if (mail($para, $titulo, $msjCorreo, $header)) { echo "<script language='javascript'> alert('Mensaje enviado, muchas gracias.'); window.location.href = 'http://TUSITIOWEB.COM'; </script>"; } else { echo 'Falló el envio'; } } ?>
Código:
@charset "utf-8"; /* CSS Document */ label { display:block; margin-top:15px; letter-spacing:1px; } .formulario { display:block; margin:0 auto; width:400px; color: #000000; font-family:Arial; } form { margin:0 auto; width:400px; } input, textarea { width:380px; height:27px; background:#000000; border:2px solid #f6f6f6; padding:10px; margin-top:5px; font-size:15px; color:#ffffff; } textarea { height:150px; } #submit { width:85px; height:35px; border:none; margin-top:20px; cursor:pointer; }