Error sending form. This simple code is not working

Asked

Viewed 21 times

-1

<form>
<div class="row">
    <div class="col-sm-12 form-group">
        <input class="form-control" id="name" name="name" placeholder="Nome" type="text" required>
    </div>
</div>
<div class="row">
    <div class="col-sm-12 form-group">
        <input class="form-control" id="email" name="email" placeholder="Email" type="email" required>
    </div>
</div>
<div class="row">
    <div class="col-sm-12 form-group">
        <select class="form-control" name="subject" required>
            <option>Assunto</option>
            <option>Orçamento Materiais</option>
            <option>Sugestão</option>
            <option>Trabalhe Conosco</option>
            <option>Outro</option>
        </select>
    </div>
</div>                      
<div class="row">
    <div class="col-sm-12 form-group">
        <textarea class="form-control" id="message" name="message" placeholder="Mensagem" rows="8" required></textarea><br>
    </div>
</div>
<div class="row">
    <div class="col-sm-12 form-group">
        <button type="submit" class="btn btn-primary btn-block btn-lg" name="send" style="border-radius:0px;">ENVIAR</button>
    </div>
</div>
</form>

<?php
//Variáveis enviadas pelo formulário
$nome = $_POST["name"];
$emailUsuario = $_POST["email"];
$assunto = $_POST["subject"];
$sugestao = $_POST["message"];

//Testando
echo $nome;
echo "<br>";
echo $emailUsuario;
echo "<br>";
echo $assunto;
echo "<br>";
echo $sugestao;
echo "<br>";    
?>
  • Be more detailed with your question provide more information so someone can help you.

2 answers

0

The Action attribute is missing with the page that will receive the form or will treat the form of this data and method attribute whether it will be POST or GET

-1


You forgot to put the action and method.

action="page where to go" method="POST"

  • Thank you. I forgot the easiest.

  • Quiet. You can also use the GET method.

  • Thank you. For now I’m learning to use only POST.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.