php - Saving select with multiple -



php - Saving select with multiple -

this question has reply here:

saving multiple select in input 3 answers

i have select input multiple set true. how save info cakephp way along validation.

<?php echo $this->form->input("user_id", array('multiple'=> 'checkbox' )); ?>

if(is_array($this->data['your_model']['user_id'])){ foreach ($this->data['your_model']['user_id'] $single){ $this->request->data['your_model']['user_id']=$single; $this->your_model->create(); $this->your_model->save($this->request->data); } } else{ $this->your_model->create(); $this->your_model->save($this->request->data); }

if array , save in loop in database using request->data.else save is

php cakephp

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -