I had to add an input to this form
$sess = CakeSession::read(‘Auth’);
echo $this->Form->create('Exportaffiliate', ['class' => 'form-horizontal']);
echo $this->Form->input('id');
echo '<div class="col-lg-6">' . $this->Form->input('subject', ['label' => __('Offer Subject')]) . '</div><div class="col-lg-6"></div>';
echo '<div class="col-lg-12">' . $this->Form->input('description', ['label' => 'Description of your offer', 'rows' => 12]) . '</div>';
echo $this->Form->input('user_id', ['type' => 'hidden', 'value' => $sess['User']['id']]);
//t0m dev inserisce nel form il valore del gruppo d'appartenenza dell'utente che crea
echo $sess['User']['group_id'];
echo $this->Form->input('user_group_id', ['type' => 'hidden', 'value' => $sess['User']['group_id']]);
$opt = [
'label' => \__('Save').' ›',
'class' => 'btn btn-primary',
'escape' => false
];
echo '<div class="col-lg-6">' . $this->Form->end($opt) .'</div>';
Tried to add the line of my interest:
echo $this->Form->input('user_group_id', ['type' => 'hidden', 'value' => $sess['User']['group_id']]);
But the value can’t be echoed then. I tried to echo like this but it echos nothing.
echo '<div class="col-lg-6">'.$this->Form->value('user_group_id').'</div>';