i wanna save data in database on cakephp here template...
echo $this->form->create(); echo $this->form->input('outtime', array( 'class' => 'outtime', 'id' => 'outtime', 'name' => 'outtime' ) ); echo $this->form->input('out date', array( 'class' => 'datepicker0', 'id' => 'outdate', 'name' => 'outdate' ) ); echo $this->form->input('return date', array( 'class' => 'datepicker0', 'id' => 'returndate', 'name' => 'returndate' ) ); echo $this->form->button(__('submit')); echo $this->form->end();
and database template.
when used save function did not work used debug function on code ...
if ($this->outs->save($out)) { $this->flash->success(__('the out has been saved.')); } else { debug($out->errors()); die; $this->flash->error(__('the out not saved. please, try again.')); }
when run result
full method code ... public function addout()
{ $uid = $this->auth->user()['id']; $out = $this->outs->newentity(); if ($this->request->is('post')) { $out = $this->outs->patchentity($out, $this->request->data); $this->request->data['user_id'] = $uid; } if ($this->outs->save($out)) { $this->flash->success(__('the out has been saved.')); } else { debug($this->request->data); exit; $this->flash->error(__('the out not saved. please, try again.')); } }
my debug out put is... debug out put hope informations you. don`t know thing error please me
Comments
Post a Comment