Hi Guys. I have a edit form. When i make changes and click update its creating a new id and insert as new.
I have 'c_id' in my table instead of 'id' Here is my code public function editContact( $c_id = null ) { //echo $c_id; if( !$c_id ) { throw new NotFoundException( __( 'Invalid Post' ) ); } $contact = $this->Contact->findBycId( $c_id ); if( !$contact ) { throw new NotFoundException( __( 'Invalid Post' ) ); } $id = $c_id; if( $this->request->is( array( 'post', 'put' ) ) ) { $this->Contact->cid = $id; echo $this->Contact->cid; if( $this->Contact->save( $this->request->data ) ) { $this->Session->setFlash( __( 'Data Updated' ) ); return $this->redirect( array( 'action' => 'index' ) ); } $this->Session->setFlash( __( 'Unable To update Data!' ) ); } if( !$this->request->data ) { $this->request->data = $contact; } } My question is how cakePHP knows the difference new post and update post -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.