Contact form sending blank emails

Hi, im having some problems with my contact form. Im anot very familiar with php, only with HTML, i made a website for my business and the contact form is having problems sending emails. When ever i ht the send button with the information on it, the only thing i get on the mails is:

Name:
Email:
Subject:
Message:

I only get the labels, everything else is blank, this is my HTML code:

<section id="contact-page">
    <div class="container">
        <div class="center">        
            <h2>Drop Your Message</h2>
            <p class="lead">Your opinion matters</p>
        </div> 
        <div class="row contact-wrap" style="background-color:#FF9900"> 
            <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="col-sm-5 col-sm-offset-1">
                    <div class="form-group">
                      <br><br>  <label>Name *</label>
                        <input type="text" name="name" class="form-control" required="required">
                    </div>
                    <div class="form-group">
                        <label>Email *</label>
                        <input type="email" name="email" class="form-control" required="required">
                    </div>
                    <div class="form-group">
                        <label>Phone</label>
                        <input type="number" class="form-control">
                    </div>
                    <div class="form-group">
                        <label>Company Name</label>
                        <input type="text" class="form-control">
                    </div>                        
                </div>
                <div class="col-sm-5">
                    <div class="form-group">
                        <br><br><label>Subject *</label>
                        <input type="text" name="subject" class="form-control" required="required">
                    </div>
                    <div class="form-group">
                        <label>Message *</label>
                        <textarea name="message" id="message" required="required" class="form-control" rows="8"></textarea>
                    </div>                        
                    <div class="form-group">
                        <button type="submit" name="submit" class="btn btn-primary btn-lg" required="required">Submit Message</button>
                    </div>
                </div>
            </form> 
        </div> 
    </div>
</section>

and this is the sendemail.php file:

<?php header('Content-type: application/json'); $status = array( 'type'=>'success', 'message'=>'Thank you for contact us. As early as possible we will contact you ' ); $name = @trim(stripslashes($_POST['name'])); $email = @trim(stripslashes($_POST['email'])); $subject = @trim(stripslashes($_POST['subject'])); $message = @trim(stripslashes($_POST['message'])); $email_from = $email; $email_to = 'contact@boasf-quinoa.com';//replace with your email $body = 'Name: ' . $name . "\n\n" . 'Email: ' . $email . "\n\n" . 'Subject: ' . $subject . "\n\n" . 'Message: ' . $message; $success = @mail($email_to, $subject, $body, 'From: <'.$email_from.'>'); echo json_encode($status); die; ?>

And this is the mail function in the php.ini file:

[mail function]
; For Win32 only.

SMTP = localhost

smtp_port = 25

; For Win32 only.

;sendmail_from = me@example.com

; For Unix only. You may supply arguments as well (default: “sendmail -t -i”).
sendmail_path = /usr/sbin/sendmail -t -i

I dont know where the problem might be, i think is in the ini file. I also copied the php processor file from another contact form that i have on another website that is working fine, but when i put it in this site, is not working, it only send blank emails, please help, thanks

Hi kvela,

You tried this way, well simple:

$name = $_POST[‘name’];
$email = $_POST[‘email’];
$subject = $_POST[‘subject’];
$message = $_POST[‘message’];

Best regards.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.