1
Hello, I’m trying to list a result of a query of my controller in an input, but it is returning zero, but when I give print_r
, it returns me all array, what’s wrong?
Controller:
public function add() {
if ($this->request->is('post')) {
if ($this->Foto->save($this->request->data)) {
$this->Session->setFlash('Recipe Saved!');
$this->render('add');
}
}
$acomodacoes = $this->Navigation->find('list');
$this->set('acomodacoes',$acomodacoes);
print_r($acomodacoes); // estou dando esse print_r só para ver se realmente existe um array
}
My form:
<?= $this->Form->create('Galeria.Foto',array('type' => 'file')); ?>
<fieldset>
<legend><?= __('Adicionar Galeria de fotos'); ?></legend>
<strong> Hot? </strong>
<?= $this->Form->checkbox('hot', array('value' => 1)); ?>
<?= $this->Form->input('acomodacoes',array('class' => 'form-control')); ?>
<?= $this->Form->input('titulo',array('class' => 'form-control')); ?>
<?= $this->Form->input('descricao',array('class' => 'form-control')); ?>
<?= $this->Form->input('Imagem', array('type' => 'file')); ?>
</fieldset>
<?php echo $this->Form->end(__('Submit',array('class' => 'form-control'))); ?>