Contact form with blank data

1

Good morning, I have a contact form on a website that I have made, but the email is coming with the blank form fields. Can anyone help me?

The email arrives but the value of $ _POST ["name"] is coming in blank.

<?php
header('Content-type: application/json');

$status = array(
    'type'=>'success',
    'message'=>'Mensagem enviada com sucesso!'
);

$nome = $_POST['nome'];
$email = $_POST['email'];
$telefone = $_POST['telefone'];
$mensagem = $_POST['mensagem'];

$email_from = $email;
$email_to = '[email protected]';


$body = 'Nome: ' . $nome . "\n\n" . 'Email: ' . $email . "\n\n" . 'Telefone: ' . $telefone . "\n\n" . 'Mensagem: ' . $mensagem;

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


echo json_encode($status);
die;

<form id="main-contact-form" class="contact-form" name="contact-form" method="POST" action="sendemail.php">
              <div class="row-fluid">
                <div class="span5">
                    <label>Nome</label>
                    <input type="text" id="nome" name="nome" class="input-block-level" required="required">
                    <label>Email</label>
                    <input type="email" class="input-block-level" required="required" id="email" name="email">
                    <label>Telefone</label>
                    <input type="text" class="input-block-level" required="required" id="telefone" name="telefone">
                </div>
                <div class="span7">
                    <label>Mensagem</label>
                    <textarea name="mensagem" id="mensagem" required="required" class="input-block-level" rows="8" style="height: 222px;"></textarea>
                </div>

            </div>
            <button type="submit" class="btn btn-primary btn-large pull-right">Enviar mensagem</button>
            <p> </p>

        </form>
    
asked by anonymous 04.06.2018 / 15:08

0 answers