How to Insert from selectMulti field

+
0
-

How best to insert data from

<?php
$form->addMultiSelect('my_field', 'My Label:', $my_var)
     ->setRequired('My Label is required.');
?>

Doing a foreach seems a bit crude.
How is this handled in nette?

<?php
foreach( $values->my_field as $my_id){
    $db->table('my_table')->insert($other_id, $my_id);
}
?>
Pavel Kravčík
Member | 1196
+
0
-
+
0
-

Pavel Kravčík wrote:

What about multi-insert?
https://doc.nette.org/…ase/explorer#…

This would still require a foreach loop, to create the values.