I need to declare a variable and call the name of an object by code and also call the type. I tried to nest foreach
but it did not work. I tried declaring the variable $tipo
out of the function but it did not work either. If I just call it, it gives an error
Undefined index: type
Follows part of the code. This code refers to a table that displays the name, type, and two buttons to delete and edit. It's all working, I just do not know how to call the type to correctly display the database information in the table.
echo '<table style="width:100%;border:2px solid #000000">';
//echo '<th style="border:1px solid #000000; background-color:#3b8ccc">Código</th>';
echo '<th style="border:1px solid #000000; background-color:#3b8ccc; width:55%">Local</th>';
echo '<th style="border:1px solid #000000; background-color:#3b8ccc">Tipo</th>';
echo '<th style="border:1px solid #000000; background-color:#3b8ccc">Ação</th>';
// $tipo= [];
foreach ($repositorio as $codigo => $nome['nome'])
{
echo '<tr>';
//echo '<td style="border:1px solid #000000">'.$codigo.'</td>';
echo '<td style="border:1px solid #000000">'.$nome['nome'].'</td>';
echo '<td style="border:1px solid #000000">'.$tipo['tipo'].'</td>';
echo '<td style="border:1px solid #000000">';
echo '<a href="index.php?r=a2d/excluiRepositorio&codobj='.$codigo.'"><i class="icon-remove" ></i> Excluir </a>';
echo '<i class="icon-null" ></i>'; //icon-null para espaçar os botoes
$this->widget('ext.popup.JPopupWindow');
echo '<a href="index.php?r=a2d/editarRepositorio&codobj='.$codigo.'" title="editarRepositorios" class="editarRepositorios"><i class="icon-edit" ></i> Editar </a>';
echo '<script type="text/javascript">';
echo '$(".editarRepositorios").popupWindow({
height:800,
width:1300,
top:50,
left:50
});';
echo '</script>';
echo '</td>';
echo '</tr>';
}
echo '<tr>';
echo '<td style="border:1px solid #000000">';
echo '<textarea style="height:20px; width:50%; resize:none" name="NovoRepositorio"></textarea>';
echo '</td>';
echo '<td style="border:1px solid #000000;vertical-align:text-bottom;">';
$this->widget('bootstrap.widgets.TbButton',
array(
'buttonType' => 'submit',
'type' => 'success',
'icon' => 'icon-plus-sign',
'label' => 'Adicionar',
)
);
echo '</td>';
echo '</tr>';
echo '</table>';