just to know if someone have any idea why this bug is happening.
I have the following code
<?php
foreach($productArray as $key=>$value)
{
if ($key == 'cod_prod')
{
?>
<td>
}
}
?>
I didnt finished the rest of the code because its working fine, except by this part.
In the example above if I put the var_dump($codeList) in the first position it prints out the results of the array just fine, if i place the var_dump($codeList) in the second position it comes back empty. If i put both the var_dumps in both positions the same thing happens
To check this im using var_dump($codeList), took out the options and everything else and the array simply come back EMPTY if I insert the select markup
Any ideas?
UPDATE
The $codeList is being generated at a controller, in this case, here
$this->setVar(array(
'DataAtual' => $Solicitacao->DataAtual,
'ClienteEmail' => $Solicitacao->clientEmail,
'ClienteNome' => $Solicitacao->userName,
'ClienteTelefone' => $Solicitacao->userTelefone,
'VendedorNome' => $Solicitacao->VendedorNome,
'VendedorEmail' => $Solicitacao->VendedorEmail,
'VendedorTelefone' => $Solicitacao->VendedorTelefone,
'PagamentoForma' => $Solicitacao->PagamentoForma,
'PagamentoPrazo' => $Solicitacao->PagamentoPrazo,
'PagamentoFrete' => $Solicitacao->PagamentoFrete,
'Produtos' => $Solicitacao->ProdutosArr,
'Observacoes' => $Solicitacao->ObservacoesArr,
'MensagemEmail' => $Solicitacao->MensagemEmail,
'PageTitle' => $Solicitacao->PageTitle,
'Action' => $Solicitacao->Acao,
'PageType' => $Solicitacao->PageType,
'vendorInfo' => $Solicitacao->vendorInfo,
**'codeList' => $Solicitacao->codeList,**
'moneyFields' => $Solicitacao->moneyFields,
'coresArr' => $Solicitacao->coresArr
));
The $Solicitacao->codeList is being generated in the Model, here (just a simple array made by wordpress)
$getCodesListSQL = "SELECT cod_prod FROM wp_products ORDER BY cod_prod ASC;";
$this->codeList = $wpdb->get_results($getCodesListSQL);
RESUME
A FULL array Gets dumped
var_dump($codeList);
echo '<select>';
//var_dump($codeList);
A EMPTY array Gets dumped
//var_dump($codeList);
echo '<select>';
var_dump($codeList);
The output is not visible because it is in a SELECT element. SELECT only accepts OPTION elements as children. Do a View Source on the generated HTML and see that the values are actually there, just that browsers don’t know what to do with them.
It depends on the browser but: when you view the generated HTML , if it is shown in a view where you can collapse nodes then it gets the HTML by calling innerHTML function on the shown element. If the inner HTML is not valid then it shows nothing.
The content is there but the browser chooses to ignore and remove it in the view you are using to view the generated HTML.