Wednesday, February 22, 2012

Why data isn't showed?

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

--
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
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: