Error en formulario de contacto
-
Buenas tardes,
Intento copiar el formulario de contacto sin plugin que la pagina de jrequejo.com pone a disposición del público, pero me sale que hay un error en la linea 12, este es el código:
<?php
/*
Template Name: Contacto
*/
?><?php
if($_POST[sent]){
$error = “”;
if(!trim($_POST[tu_nombre])){
$error .= “<p>Por favor, tu nombre es…</p>”;
}
if(!filter_var(trim($_POST[tu_email]),FILTER_VALIDATE_EMAIL)){
$error .= “<p>El email no es válido</p>”;
}
if(!trim($_POST[tu_mensaje])){
$error .= “<p>Quizá olvidaste el mensaje…</p>”;
}
if(!trim($_POST[el_asunto])){
$error .= “<p>Falta el asunto</p>”;
}
if(!$error){
$email = wp_mail(get_option(“admin_email”),trim($_POST[tu_nombre]).” Se ha enviado un mensaje desde “.get_option(“blogname”),stripslashes(trim($_POST[tu_mensaje])),”De: “.trim($_POST[tu_nombre]).” <”.trim($_POST[tu_email]).”>\r\nReply-To:”.trim($_POST[tu_email]));
}
}
?>
<?php get_header(); ?>
<div id=”container”>
<div id=”content” role=”main”>
<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
<div id=”post-<?php the_ID(); ?>” <?php post_class(); ?>>
<h1><?php the_title(); ?></h1>
<div>
<?php if($email){ ?>
<p>Mensaje enviado. Te responderemos lo antes posible</p>
<?php } else { if($error) { ?>
<p>Tu mensaje NO ha sido enviado<p>
<?php echo $error; ?>
<?php } else { the_content(); } ?>
<form action=”<?php the_permalink(); ?>” id=”contacto” method=”post”>
<input type=”hidden” name=”sent” id=”sent” value=”1″ />
<div id=”form”>
<div id=”lebel”>Nombre (requerido)</div>
<div id=”input-field”><input type=”text” name=”tu_nombre” id=”tu_nombre” value=”<?php echo $_POST[tu_nombre];?>” /></div>
<div id=”lebel”>Email (requerido)</div>
<div id=”input-field”><input type=”text” name=”tu_email” id=”tu_email” value=”<?php echo $_POST[tu_email];?>” /></div>
<div id=”lebel”>Asunto</div>
<div id=”input-field”><input type=”text” name=”el_asunto” id=”el_asunto” value=”<?php echo $_POST[el_asunto];?>” /></div>
<div id=”lebel”>Tu mensaje (requerido)</div>
<div id=”input-field”><textarea name=”tu_mensaje” id=”tu_mensaje”><?php echo stripslashes($_POST[tu_mensaje]); ?></textarea></div>
<div id=”lebel”> </div>
<div id=”input-field”><input type=”submit” name = “send” value = “Enviar” /></div>
</div></form>
<?php } ?>
</div><!– .entry-content –>
</div><!– #post-## –>
<?php endwhile; ?>
</div><!– #content –>
</div><!– #container –><?php get_footer(); ?>
Gracias
- El debate ‘Error en formulario de contacto’ está cerrado a nuevas respuestas.