Las variables las traigo desde el fichero contact.php del formulario y hago el envio del formulario al email.php para que cree el cuerpo del mensaje y lo envie a las direcciones correctas.
contact.php
Código PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTMLExtensible HyperText Markup Language 1.0 Strict//EN"
#
"http://www.w3.org/TR/xhtml1/DTDDocument Type Definition/xhtml1-strict.dtd">
#
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="es" lang="es">
#
<head profile="http://gmpg.org/xfn/1">
#
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
#
<title>Formulario de Contacto</title>
#
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
#
<script type="text/javascript">
#
function stoperror(){
#
return true
#
}
#
window.onerror=stoperror
#
</script>
#
<link rel="stylesheet" type="text/css" href="style.css" media="screen" />
#
</head>
#
<body>
#
<div id="contactform">
#
<h1>Formulario de Contacto</h1>
#
<form id="contact-form" method="post" onsubmit="return emailCheck(this.email.value);" action="email.php">
#
<fieldset>
#
<legend>Datos Personales »</legend>
#
<div>
#
<label for="visitorname">
#
<span style="color:#c00;">*</span>Nombre:
#
</label>
#
<input type="text" name="name" id="visitorname" title="Tu Nombre" />
#
</div>
#
<div>
#
<label for="visitorsurname">
#
<span style="color:#c00;">*</span>Apellidos:
#
</label>
#
<input type="text" name="surname" id="visitorsurname" title="Tu Apellido" />
#
</div>
#
<div>
#
<label for="visitormail">
#
<span style="color:#c00;">*</span>Dirección de correo:
#
</label>
#
<input type="text" name="email" id="visitormail" value="<?php echo $email; ?>" title="Tu dirección de correo" />
#
</div>
#
<div>
#
<label for="url">Página Web:</label>
#
<input type="text" name="url" id="url" class="text" title="Tu página web" />
#
</div>
#
<div>
#
<label for="phone">Teléfono:</label>
#
<input type="text" name="phone" id="phone" class="text" title="Tu número de telefono" />
#
</div>
#
<div>
#
<label for="postcode">Poblacion:</label>
#
<input type="text" name="postcode" id="postcode" class="text" title="El codigo postal de tu localidad" />
#
</div>
#
<div>
#
<input type="submit" id="submit" name="send" value="Enviar »" title="Pulsa una vez para enviar el mensaje, y espera a la pantalla de confirmación" />
#
</div>
#
</fieldset>
#
<fieldset>
#
<legend>Envianos tu Mensaje »</legend>
#
<div>
#
<label for="subject">
#
<span style="color:#c00;">*</span>Motivo del mensaje:
#
</label>
#
<input type="text" name="sub" id="subject" title="El motivo de tu mensaje" />
#
</div>
#
<div>
#
<label for="notes">
#
<span style="color:#c00;">*</span>Cuerpo del Mensaje:
#
</label>
#
<textarea name="text" id="notes" rows="" cols="" onkeyup="val=this.value; if (val.length > 800) { alert('Lo siento, has sobrepasado el limite de 800 caracteres'); this.value = val.substring(0,800); } this.form.count.value=800-parseInt(this.value.length); "><?php echo $text; ?></textarea>
#
</div>
#
<div>
#
<label for="count">Caracteres disponibles:</label>
#
<input type="text" name="count" id="counter" value="800" size="2" />
#
<?php $text_len = preg_match_all('/./', $str, $dummy); ?>
#
</div>
#
</fieldset>
#
</form>
#
<p><span style="color:#c00;">*</span>Campos Obligatorios</p>
#
<p><span style="color:red;font-weight:bold;"><?php echo $error ?></span></p>
#
<script type="text/javascript" src="var.js"></script>
#
</div>
#
</body>
#
</html>
#