0
All screen transitions, when I need to call a given variable, are with this problem. Always returns the vector as empty.
When transitions are made with defined value, for example: $_POST ['vaga'] = ['2']
, the vector is returned with all its variables (40)
error-free on the form html
.
But the problem is that the value quoted in the example ['2']
must be variable because it must be assigned from another list. The relation is:
page 1 - list of vacancies with 5 main variables and 1 button to display the details of the vacancy;
page 2 - details of the selected vacancy on page 1 button;
The code that works with the fixed variable is:
include_once('class_vaga.php');
$obj = new class_vaga();
$obj->host = '127.0.0.1';
$obj->username = 'root';
$obj->password = '';
$obj->table = 'vaga';
$obj->connect();
$_POST ['vaga'] = ['2'];
$return = json_decode($obj->ajaxCall('load_detalhes_vagas',array($_POST['vaga'][0])));
var_dump($return);
?>
When I try to vary it according to the clicked button, the problem comes. I noticed that this occurs in all other pages (login, graphics, etc), because whenever I use a fixed number the system accepts, when it comes to making it variable the thing hangs.
Code that doesn’t work:
include_once('class_vaga.php');
$obj = new class_vaga();
$obj->host = '127.0.0.1';
$obj->username = 'root';
$obj->password = '';
$obj->table = 'vaga';
$obj->connect();
$id_vaga = ' ';
foreach ($_POST as $key => $value) {
if($key == "action"){
$action = $value;
}else{
$id_vaga = $value;
}
}
$return = json_decode($obj->ajaxCall('load_detalhes_vagas',array($id_vaga)));
var_dump($return);
?>
page 2 call function is:
function loaddetalhes(idVaga){
$.ajax({
type: "POST",
url: 'http://localhost/workspace/detalhes_vaga.php',
data: { action: 'load_detalhes_vagas', vaga: idVaga },
dataType: "json",
complete: function (data){
window.open('detalhes_vaga.php');
},
});
}
look in the field of hml if you put the name attribute. Because the problem is in the parameter passage. add here your html code of form 1 and I’ll show you where the problem is
– Israel Zebulon
I cannot include the code here in the comment...lack space
– andre
<img src="imgs/plus.png" width="30" height="30" alt="More information§Ãµes" style="cursor:Pointer" id="btnloaddetails" name="detalhesvaga" onclick="loaddetalhes('<?= $v->id_vaga; >');"></td>
– andre
edit your question and include html
– Israel Zebulon