1
I’m trying to do a POST and it’s right in parts, only when I try to send the value of FORM to the destination of the post it gets the blank value. See my code:
This is the form that sends the POST
<?php include 'masterpage.php'; ?>
<div class="row">
<div class="col-lg-12">
<form id="partida-form" action="" method="POST">
<span class="glyphicon glyphicon-exclamation-sign"></span>
<span style="color:red" id="mensagem"></span>
<div class="ml-auto" style="float: right;">
<select name="teste" id="teste" class="form-control">
<option value="19">carmolandia</option>
<option value="1">Sem equipe</option>
</select>
<button type="button" style="min-width: 110px; max-width: 110px" class="btn btn-outline-primary" name="btnPartida" id="btnPartida">Selecionar</button>
</div>
</form>
</div>
<div id="conteudo" class="col-lg-12">
</div>
</div>
<?php include 'footer.php'; ?>
Then the key.php file
<?php
include 'code-source/return/partida.php';
$teste = (isset($_POST['teste'])) ? $_POST['teste'] : '' ;
echo $teste;
?>
<div id="tab" class="row">
<?php for($a = 0; $a < $x; $a++){ ?>
<div class="col-sm-6">
<div class="table-responsive" style="font-size: 14px !important;">
<table id="tabelaEquipe" class="table table-borderless table-striped table-earning">
<thead>
<tr>
<th>Grupo: <b><?php echo $chave[$a].' - '.$rodada[$a] ?></th>
</tr>
</thead>
<tbody>
<tr>
<td><?php echo $equipe_1[$a].' <b>CONTRA</b> '.$equipe_2[$a]?> </td>
</tr>
</tbody>
</table>
<div><b>Local:</b> <?php echo $local[$a].' <b>Horário:</b> '.$hora[$a]?></div>
</div>
</div>
<?php } ?>
</div>
<?php ?>
And finally, the JS file that makes the post with AJAX
$("#btnPartida").click(function(){
$.ajax({
type : 'POST',
url : 'chaves.php',
async: true,
}).done(function(data){
$("#conteudo").html(data);
});
the problem is here:
$teste = (isset($_POST['teste'])) ? $_POST['teste'] : '' ;
echo $teste;
I want to take the value of the test field, but it keeps seeing blank, or worthless.
Thanks for the help, but this does not solve the problem of the post, it is already working this stop the problem is that it does not SEND the value of the form.
– Marcos Vinicius Leão
Without the
data:
nothing will even go to PHP.– Sam
Really, I pressed Ctrl F5 to force the load and it worked. I love you! Very grateful. rsrs
– Marcos Vinicius Leão