<section id="contact-page" class="container">
<div class="row-fluid">
<div class="span8">
<h4>Contacto</h4>
<div class="status alert alert-success" style="display: none"></div>
<form id="main-contact-form" class="contact-form" name="contact-form" method="post" action="sendemail.php">
<div class="row-fluid">
<div class="span5">
<label>Nombre</label>
<input type="text" class="input-block-level" required placeholder="...">
<label>Asunto</label>
<input type="text" class="input-block-level" required placeholder="...">
<label>E-mail </label>
<input type="text" class="input-block-level" required placeholder="...">
</div>
<div class="span7">
<label>Mensaje</label>
<textarea name="message" id="message" required class="input-block-level" rows="8"></textarea>
</div>
</div>
<button type="submit" class="btn btn-primary btn-large pull-right">Enviar mensaje</button>
<p> </p>
</form>
</div>
This above is the html form code I have .
php email script I am using is below
<?php
header('Content-type: application/json');
$status = array(
'type'=>'success',
'message'=>'Su e-mail ha sido enviado. Nos pondremos en contacto con usted lo antes posible'
);
$name = @trim(stripslashes($_POST['Nombre']));
$email = @trim(stripslashes($_POST['E-mail']));
$subject = @trim(stripslashes($_POST['asunto']));
$message = @trim(stripslashes($_POST['Mensaje']));
$email_from = $email;
$email_to = 'tallerdelinstrumento@gmail.com';
$body = 'Nombre: ' . $name . "\n\n" . 'E-mail: ' . $email . "\n\n" . 'Asunto: ' . $subject . "\n\n" . 'Mensaje: ' . $message;
$success = @mail($email_to, $subject, $body, 'From: <'.$email_from.'>');
echo json_encode($status);
die;
?>
Thats the code I am using for form . The javascript code is the following
jQuery(function($) {
//Ajax contact
var form = $('.contact-form');
form.submit(function () {
$this = $(this);
$.post($(this).attr('action'),$(this).serialize(), function(data) {
$this.prev().text(data.message).fadeIn().delay(3000).fadeOut();
},'json');
return false;
});
//Goto Top
$('.gototop').click(function(event) {
event.preventDefault();
$('html, body').animate({
scrollTop: $("body").offset().top
}, 500);
});
//End goto top
});
I recieved the e-mail, but the content is blank. I don´t find the mistake. Please help, I´m new student in this topic. Thanks you!!