Skip to content

Instantly share code, notes, and snippets.

@eminetto
Created November 2, 2011 23:09
Show Gist options
  • Save eminetto/1335245 to your computer and use it in GitHub Desktop.
Save eminetto/1335245 to your computer and use it in GitHub Desktop.
public function createAction()
{
$form = new Application_Form_Post();
$post = new Application_Model_Posts();
//tem dados
if ($this->_request->isPost()) {
//form valido
if ($form->isValid($this->_request->getPost())) {
$id = $post->insert($form->getValues());
$this->_redirect('post/retrieve');
}//form invalido
else { // Mostra os erros e popula o form com os dados
$form->populate($form->getValues());
}
}
$this->view->form = $form;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment