I'm trying to get data from a form, where some fields I use Ajax more specifically the plugin X-Editable
.
When I receive my PHP page, the following error message appears.
HTML:
<form class="form-horizontal" id="termo8" action="procTermo.php" method="POST" target="_blank">
<div class="panel-group">
<div class="panel panel-success">
<div class="panel-heading">
<h3 class="panel-title">
<a data-toggle="collapse" href="#capaTermo8">08. Termo Abertura</a>
</h3>
</div>
<div id="capaTermo8" class="panel-collapse collapse">
<div class="panel-body">
<div class="form-group">
<label class="col-xs-3 control-label">Serial:</label>
<div class="col-xs-3">
<input type="text" class="form-control" name="SerialTermo8" required/>
</div>
</div>
<div class="form-group">
<div class="well text-justify well-sm">
Aos <a href='#' id='diaTermo8'>28</a> dias do mês de <a href='#' id='mesTermo8'>Setembro</a> de <a href='#' id='anoTermo8'>2015</a>,
nesta cidade de <a href='#' id='cidadeTermo8'>CIDADE</a> – <a href='#' id='estadoTermo8'>UF</a>, realizo a abertura deste edital.
</div>
</div>
<div class="cleanfix"></div>
<button class="btn btn-inverse" name="btnGerar" value="gerar8">Gerar <span class="glyphicon glyphicon-save"></span></button>
</div>
</div>
</div>
</div>
</form>
When I click on any of these links it opens a popover so I can edit the data that is already set between <a>
, when I click OK, it overrides the value. / p>
Ajax (X-Editable):
<script type="text/javascript">
$(document).ready(function() {
$.fn.editable.defaults.send = "always";
$.fn.editable.defaults.url = "procTermo.php";
$.fn.editable.defaults.ajaxOptions = {type: "POST"};
$('#diaTermo8').editable({type:'text',title: 'Informe o dia'});
$('#mesTermo8').editable({type:'text',title: 'Informe o mes'});
$('#anoTermo8').editable({type:'text',title: 'Informe o ano'});
$('#cidadeTermo8').editable({type:'text',title: 'Informe a Cidade'});
$('#estadoTermo8').editable({type:'text',title: 'Informe o estado'});
});</script>
PHP (procTermo.php):
switch ($_POST['btnGerar']) {
case 'gerar8':
$varMesTermo8 = $_POST['mesTermo8'];
$varDiaTermo8 = $_POST['diaTermo8'];
$varAnoTermo8 = $_POST['anoTermo8'];
$varCidadeTermo8 = $_POST['cidadeTermo8'];
$varEstadoTermo8 = $_POST['estadoTermo8'];
break;
}
When I give echo
to any of these variables, it returns the error below.
Error:
Notice: Undefined index: mesTermo8, dayTermo8 (All same error) in /var/www/system/procTermo.php
And in print_r($_POST)
, does not bring any data.