Notice (8): Undefined variable in cakePHP

0

When I updated the changes in sight, I get this error:

  

Notice (8): Undefined variable: manager [APP \ View \ Views \ browser2.ctp, line 133]

I have reviewed up and down and nothing .. I keep giving the same error ...

Similar to this I have it in another browser1.ctp view and it works perfectly ...

If someone gives me a north ....

Thanks

Here is the code ... line 133 in the original here is 35

echo '<table>';
echo '<tr>';
    echo '<th></th>';
    foreach ($campos as $campo => $nombre){
        echo '<th>'.$paginator->sort($campo, $nombre).'</th>';
    }
echo '</tr>';
foreach ($leads as $lead){
    echo '<tr>';
    echo '<td>';
    echo $this->Html->link(
        'Editar',
        '#',
        array('class' => 'edit_button', 'target' => '',"onclick"=>'openWindow("'.$lead['Vista']['id'].'","90%","100%");')
    );  
    echo '</td>';

    foreach ($campos as $campo => $nombre){
        if (is_numeric ($lead['Vista'][$campo]) or in_array($campo,$dates)) $clase='numeric';
        else $clase='texto';
        if (in_array($campo,$modificables))  $clase='desplegable';

        echo '<td class="'.$clase.'">';

        if (in_array($campo,$modificables)){
    if ($campo == 'valid_status') {
      echo '<form action="javascript:save_text('.$lead['Vista']['id'].')">';
      echo $this->Form->input('valid_status', array('div'=>false, 'class'=>'selection_'.$lead['Vista']['id'],'label'=>false, 'selected'=>$lead['Vista'][$campo], 
        'name'=>$lead['Vista']['id'].'_select','options' => array($status),'onChange'=>'this.form.submit()'));
      echo '<div class="div_sta_'.$lead['Vista']['id'].'"></div>';
      echo '</form>';
    } else {
      echo '<form action="javascript:save_gestor('.$lead['Vista']['id'].')">';
      echo $this->Form->input('id_gestor', array('div'=>false, 'class'=>'gestor_'.$lead['Vista']['id'],'label'=>false, 'selected'=>$lead['Vista'][$campo], 
        'name'=>$lead['Vista']['id'].'_select','options' => array($gestor),'onChange'=>'this.form.submit()')); // ESTA ES LA LÍNEA DEL ERROR
      echo '<div class="div_ges_'.$lead['Vista']['id'].'"></div>';
      echo '</form>';
    }
        }else if (in_array($campo,$dates)){
            if ($lead['Vista'][$campo]=='') echo 'N/A';
            else echo date('d/m/Y', strtotime($lead['Vista'][$campo]));
        }else echo $lead['Vista'][$campo];

        echo '</td>';

    }
    echo '</tr>';
}
    
asked by José Ramón Quintero García 25.10.2017 в 23:49
source

1 answer

0

You are using the manager variable and you have not assigned a value to it.

echo $this->Form->input('id_gestor', array('div'=>false, 'class'=>'gestor_'.$lead['Vista']['id'],'label'=>false, 'selected'=>$lead['Vista'][$campo], 
        'name'=>$lead['Vista']['id'].'_select','options' => array($gestor),'onChange'=>'this.form.submit()'));

You must initialize variable $gestor before using it

$gestor = 'valorpordefecto';

Then you can already.

echo $this->Form->input('id_gestor', array('div'=>false, 'class'=>'gestor_'.$lead['Vista']['id'],'label'=>false, 'selected'=>$lead['Vista'][$campo], 
        'name'=>$lead['Vista']['id'].'_select','options' => array($gestor),'onChange'=>'this.form.submit()'));
    
answered by 26.10.2017 в 00:51