0
I’m trying to detect a post in a form but I can’t, actually it doesn’t 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();?>
Have you tried to check if any variables from your form came in
$_POST
and is not empty?– fernandoandrade