Whoops, I sent the wrong answer, here again
public function edit($id = null) {
if (!$this->Article->exists($id)) {
throw new NotFoundException(__('Invalid article'));
}
if ($this->request->is(array('post', 'put'))) {
if ($this->Article->save($this->request->data)) {
$this->Session->setFlash(__('The article has been saved.'));
return $this->redirect($this->request->data['Article']['referer']);
} else {
$this->Session->setFlash(__('The articlecould not be saved. Please, try
again.'));
}
} else {
$options = array('conditions' => array('Article.' .
$this->Article->primaryKey => $id));
$this->request->data = $this->Article->find('first', $options);
}
$this->set('referer',$this->referer();
}
edit.ctp
<?php echo $this->Form->hidden('referer', array('value' =>$referer)); ?>
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.