you have "country_id" as your primary key in table ? and "Countries" for modelname ? it should be "Country" right ? :)
$this->Countries->country_id = $id; //this is wrong here should be ALWAYS "id", so $this->Countries->id = $id; but u should use camelized and singularized name, so $this->Country->id = $id and it will work VIEW: Form::create(); here you should have the same model name as you pass data, "Country" and not CountryFrm -- Lep pozdrav, Tilen Majerle http://majerle.eu 2012/2/23 [email protected] <[email protected]> > Hi every: > Take a look at this function: > > public function edit($id = null) { > $this->Countries->country_id = $id; > if ($this->request->is('get')) { > $this->request->data = $this->Countries->read(); > } else { > if ($this->Countries->save($this->request->data)) { > $this->Session->setFlash(__('The country has been updated.')); > $this->redirect(array('action' => 'index')); > } else { > $this->Session->setFlash(__('Unable to update the country.')); > } > } > } > > Aparently all seems to be fine but surprise when I call edit method and > pass a ID as parameter the data isn't showed in the template, why? Any > help? This is the edit.ctp content: > > <h1>Edit Country</h1> > <?php > echo $this->Form->create('CountryFrm', array('action' => 'edit')); > echo $this->Form->input('country_name'); > echo $this->Form->input('iso_code_2'); > echo $this->Form->input('iso_code_3'); > echo $this->Form->input('country_id', array('type' => 'hidden')); > echo $this->Form->end('Save!!!'); > > > Ing. Reynier Pérez Mira > http://reynierpm.site90.com/ > > -- > Our newest site for the community: CakePHP Video Tutorials > http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > [email protected] For more options, visit this group > at http://groups.google.com/group/cake-php > -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php
