0

I have a contact form in my website, when I send the form I'm getting empty email. I mean that I see the content of the mail but I don't see the parameters. That's the contact form:

contact.php

<div class="status alert alert-success" style="display: none"></div>
<form id="main-contact-form" enctype='application/json' class="contact-form" name="contact-form" method="post" action="sendemail.php" role="form">
    <div class="row">
        <div class="col-sm-5">
            <div class="form-group">

                <input type="text" name="fullname" class="form-control" required="required" placeholder="Full Name">
            </div>
            <div class="form-group">
                <input type="text" name="phone" class="form-control" placeholder="Phone Number">
            </div>
            <div class="form-group">
                <input type="email" name="emailaddress" class="form-control" required="required" placeholder="Email Address">
            </div>
            <div class="form-group">
                <input type="submit" class="btn btn-primary btn-lg" value="SEND">
            </div>
        </div>
        <div class="col-sm-7">
            <textarea name="message" id="message" required class="form-control" rows="8" placeholder="Message"></textarea>
        </div>
    </div>
</form>

and that's the file of the action:

sendemail.php

<?php
header('Content-type: application/json');
$status = array(
    'type'=>'success',
    'message'=>'Email Sent!'
);

$name = htmlspecialchars($_REQUEST['fullname']); 
$email = htmlspecialchars($_REQUEST['emailaddress']); 
$phone = htmlspecialchars($_REQUEST['phone']); 
$subject = 'MSG FROM '. $name; 
$message = htmlspecialchars($_REQUEST['message']); 

$email_from = $email;
$email_to = 'contact@tazminu.co.il';

$body = 'Name: ' . $name . "\n\n" . 'Email: ' . $email . "\n\n" . 'Phone: ' . $phone . "\n\n" . 'Message: ' . $message;

$success = @mail($email_to, $subject, $body, 'From: <'.$email_from.'>');

echo json_encode($status);
die;

?>

PLEASE HELP :(

The Dude
  • 363
  • 1
  • 14
Adir Cohen
  • 19
  • 1
  • 6

0 Answers0