Implode before save


I have a Multiple Selection Box in a view, and I want to save it in just one single field, implode (coma separated values).

¿How can this be done?


Been there, done that, regretted it heartily later on. Do your later self a favour, and build the many-to-many join table now.

agree with Zuluru.

but if you still need to use implode use this (select eg: email):

$email_array =  $this->request->getData('email_string');
$email_string = join(", ",$email_array);


When my select is multiple true, I do debug and there is no value But if multiple option is not set it sends the value.

What can be?

echo $this->Form->control('pruebas_realizadas',  ['type' => 'select', 'options' => $pruebaPsicometricas, 'multiple'=>'true']); 

'seleccione_id' => (int) 193
 'conclusiones' => 'sdd'
 'created' => object(Cake\I18n\FrozenTime) id:1 { }
 'modified' => object(Cake\I18n\FrozenTime) id:2 { }
 'created_by' => (int) 5
 'modified_by' => (int) 5

When it’s a single select, the value you get will be a single value. When it’s a multi-select, the value will be an array. I think you need to name your control like pruebas_realizadas._ids. See Saving Data - 4.x for more details.