Submit in form Bootstrap does not pass data via post!

Asked

Viewed 563 times

1

Hello, I have an html form using bootstrap, but I can not send via post. *detail, form without using bootstrap style goes smoothly. follows my form:

<div class="row contact-wrap"> 
                <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">
                            <label>NOME *</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>TELEFONE *</label>
                            <input type="number" name="telephone" class="form-control" required="required">
                        </div>
                        <div class="form-group">
                            <label>NOME DA EMPRESA</label>
                            <input type="text" name="employer" class="form-control">
                        </div>                        
                    </div>
                    <div class="col-sm-5">
                        <div class="form-group">
                            <label>ASSUNTO *</label>
                            <input type="text" name="subject" class="form-control" required="required">
                        </div>

                        <div class="form-group">
                            <label>SUA MENSAGEM *</label>
                            <textarea name="message" id="message" required="required" class="form-control" rows="5"></textarea>
                        </div>                        
                        <div class="form-group">
                            <input type="submit" name="submit" class="btn btn-info btn-lg" required="required" value="ENVIAR">
                        </div>
                    </div>
                </form> 
            </div>
  • do you do it directly or use some javascript? o $_POST comes blank in php? gave a print_r()?

  • @Fabricio , could put more details of the file sendemail.php?

1 answer

1


Just try to go in your php and do this:

<?php
   $nome = $_POST['name'];
   print_r($nome);
?>

That’s what they said in the commentary, but just test. Remember that in php when making a Submit in the form, you have to use the field name and not the ID.

  • Nothing comes out! But if I do Submit with the form outside of the bootstrap style, it goes without problem. I don’t want to use js to do just this part.

  • 1

    nor need, I didn’t realize yet what the problem is? If you want to only receive the form data, this way it will work :)

  • method="post" action="sendemail.php", and the name of the Fields will be what you have to pick up in the php area. This will work just fine

Browser other questions tagged

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