$ _SERVER ['REQUEST_METHOD'] == "POST" Does not work PHP wordpress

0

I'm trying to detect a post on a form but I can not, it actually does not work.

<?php /* Template Name: Contato */

get_header();
get_template_part( 'components/header/header', 'text' );
$options = get_option('theme_options');
?>

<div class="container">
    <?php
    if ($_SERVER['REQUEST_METHOD'] == "POST"){
        // envia o form / email
        send_contact_form();
        $resposta = "FUNCIONOO";
        echo "FUNCIONO";

    } else { //mostra o formulario
        ?>

    <div class="col-md-8 panel-custom">

        <div class="card container-quem_somos">

            <form class="form-horizontal" method="post">
                <h4 class="content-header">Fale conosco</h4>
                <fieldset>
                    <div style="padding:30px 0 31px 0;" class="grey-text">

                        <div class="form-group">
                             <div class="col-lg-8">
                                 <label class="control-label label-text" for="inputName">Nome*</label>
                                 <input type="text" class="form-control input-custom" name="name" id="inputName" placeholder="">

                             </div>
                         </div>
                         <div class="form-group">
                             <div class="col-lg-8">
                                 <label class="control-label label-text" for="inputEmail">E-mail*</label>
                                 <input type="text" class="form-control input-custom" name="email" id="inputEmail" placeholder="">

                             </div>
                         </div>
                         <div class="form-group">
                             <div class="col-lg-8">
                                 <label class="control-label label-text" for="inputPhone">Telefone</label>
                                 <input type="tel" class="form-control input-custom" name="phone" id="inputPhone" placeholder="">
                             </div>
                         </div>
                         <div class="form-group">
                             <div class="col-lg-8">
                                 <label class="control-label label-text" for="inputMensagem">Mensagem</label>
                                 <textarea type="text" class="form-control input-custom" name="message" rows="3" id="inputMensagem" placeholder=""></textarea>

                             </div>
                         </div>
                         <div class="form-group">
                             <div class="col-lg-8">
                                 <div class="more" style="text-align:left;margin-top:14px">
                                     <a type="submit" name="sub" style="width:120px" href="">enviar</a>
                                 </div>
                            </div>
                        </div>
                        <p><?php echo $resposta ?></p>
                    </div>
                </fieldset>
            </form>

        </div>
    </div>
    <?php } ?>
</div>

<?php
get_footer();?>
    
asked by anonymous 26.11.2016 / 00:20

1 answer

2

Your form does not have input or button to work.

Switch

<a type="submit" name="sub" style="width:120px" href="">enviar</a>

by

<input type="submit" value="enviar" />

And it will send.

    
26.11.2016 / 01:22