1
사용자는 여기서 시작 저장 검증을 시도하기에 실패 할 때 편집 URL 변수를 잃는다. ,CakePHP의
/admin/cuisines/edit/
사용자가 자신의 실수를 수정, 클릭 제출, 대신 편집의 : - : 사용자가 여기에 촬영 그들은 여기에 촬영하고
/admin/cuisines/edit/16
사용자는 유효하며 클릭 다시 제출 생각 ID가 없으므로 테이블의 새 항목으로 저장합니다.
내 코드 : 내가 잘못 뭘하는지에
function admin_edit($id = null) { // EDIT ***********
if (!$id && empty($this->data)) {
$this->Session->setFlash(__('Invalid cuisine', true));
$this->redirect(array('action' => 'index'));
}
if (!empty($this->data)) {
if ($this->Cuisine->save($this->data)) {
$this->Session->setFlash(__('The edits to this cuisine have been saved', true));
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('The edits to this cuisine could not be saved. Please, try again.', true));
}
}
if (empty($this->data)) {
$this->data = $this->Cuisine->read(null, $id);
}
}
어떤 생각? 나는 내가 튜토리얼과 똑같이 해냈다 고 생각했지만, - 케잌이 이런 일이 일어나지 않도록 충분히 똑똑하다는 것을 추측해야 할 것입니다 - 예 - 제 생각에 저는 잘못된 것을하고 있습니다.
나는 당신을 사랑하고, 나는 stackoverflow를 사랑한다! 고맙습니다! (그리고 당신의 첫 번째 대답에 grat!) :) – Dave