我不能让它工作(联系表格)

时间:2015-09-18 10:53:20

标签: contact-form

我有一个新网站,但我无法获得联系表格。当我按下发送按钮时,它什么也没做。我在互联网上搜索但我不能让它工作。有人可以看看它。我对一切都很感兴趣。这是代码:

mainjs

// Contact form
var form = $('#main-contact-form');
form.submit(function(event){
    event.preventDefault();
    var form_status = $('<div class="form_status"></div>');
    $.ajax({
        url: $(this).attr('action'),
        beforeSend: function(){
            form.prepend( form_status.html('<p><i class="fa fa-spinner fa-spin"></i> Email wordt verstuurd...</p>').fadeIn() );
        }
    }).done(function(data){
        form_status.html('<p class="text-success">Bedankt voor uw Email. We zullen z.s.m. contact met u opnemen!</p>').delay(3000).fadeOut();
    });
});

PHP

&#13;
&#13;
<?php
$name       = @trim(stripslashes($_POST['name'])); 
$from       = @trim(stripslashes($_POST['email']));
$phone       = @trim(stripslashes($_POST['phone']));
$subject    = @trim(stripslashes($_POST['subject'])); 
$message    = @trim(stripslashes($_POST['message'])); 
$to   		= 'info@desysteembeheerder.nl';

$headers   = array();
$headers[] = "MIME-Version: 1.0";
$headers[] = "Content-type: text/plain; charset=iso-8859-1";
$headers[] = "From: {$name} <{$from}>";
$headers[] = "Phone: <{$phone}>";
$headers[] = "Reply-To: <{$from}>";
$headers[] = "Subject: {$subject}";
$headers[] = "X-Mailer: PHP/".phpversion();

mail($to, $subject, $message, $headers);

die;
&#13;
&#13;
&#13;

HTML:

        <div class="contact-form wow fadeIn" data-wow-duration="1000ms" data-wow-delay="600ms">
      <div class="row">
        <div class="col-sm-6">
          <form id="main-contact-form" name="contact-form" method="post" action="sendemail.php">
            <div class="row  wow fadeInUp" data-wow-duration="1000ms" data-wow-delay="300ms">
              <div class="col-sm-6">
                <div class="form-group">
                  <input type="text" name="name" class="form-control" placeholder="Naam" required="required">
                </div>
              </div>
              <div class="col-sm-6">
                <div class="form-group">
                  <input type="email" name="email" class="form-control" placeholder="Email Adres" required="required">
                </div>
              </div>
            </div>
            <div class="form-group">
              <input type="text" name="phone" class="form-control" placeholder="Telefoonummer" required="required">
            </div>
            <div class="form-group">
              <input type="text" name="subject" class="form-control" placeholder="Onderwerp" required="required">
            </div>
            <div class="form-group">
              <textarea name="message" id="message" class="form-control" rows="4" placeholder="Bericht" required="required"></textarea>
            </div>                        
            <div class="form-group">
              <button type="submit" class="btn-submit">Verzenden</button>
            </div>
          </form> 
        </div>

0 个答案:

没有答案