0
Galera blz...,
I am editing a field to save to db, I send to Edit.ctp the following array
$result = array_merge($cones->toArray(), $cda->toArray());
debug($result);
//Upshot:
[
(int) 0 => 'Valor 1',
(int) 1 => 'Valor 2',
(int) 2 => 'Valor 3'
]
//Edit.ctp
<?php
echo $this->Form->control('name',
[
'empty' => 'Selecione um cone',
'label' => false,
'type' => 'select',
'options' => $result
]);
?>
But when I run to save in the bank it saves the content and not the value of it. Result of $this->request->data;
[
'name' => '0'
]
I’m new to php, tried some things like array_values, and some unsuccessful searches. Thanks in advance.
I think it was not well explained, in the case of imput its type is a select, the user will select one of those 3 and save the form, but in the database when it saves instead of saving "value 1" it saves the Dice 0
– Rodrigo Gaster