I have Ipr_forms
table in my Db i want to update the row but the following code give me job_id
of that table.which is not my requirement.....i want table id to update the existing table
My controller code
$id =$this->request->data['IprForm']['id'];
$ipr_forms['job_id'] = $this->request->data['IprForm']['job_id'];
$ipr_forms['IprForm'] = $this->request->data['IprForm'];
$this->IprForm->id = $id;
//debug($id);
$ipr_forms_save = $this->IprForm->save($ipr_forms);
If i debug the id ,$id
variable hold the job_id ....
here i can give you an example to edit any record in cakephp with multiple fields
just take look in function and you may have good idea
public function edit($id = null) {
if (!$id) {
throw new NotFoundException(__('Invalid post'));
}
$post = $this->Post->findById($id);
if (!$post) {
throw new NotFoundException(__('Invalid post'));
}
if ($this->request->is('post') || $this->request->is('put')) {
$this->Post->id = $id;
if ($this->Post->save($this->request->data)) {
$this->Session->setFlash(__('Your post has been updated.'));
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('Unable to update your post.'));
}
}
if (!$this->request->data) {
$this->request->data = $post;
}
}
or you can also refer detail cakephp.org link with title of editing posts