Home Tutorial Php Zendframework Zend FrameWork Part-11


Share on Google+Share on Google+
Zend FrameWork Part-11
Posted on: April 20, 2010 at 12:00 AM
This is the eleventh and second last installment of the ZF Tutorial series. In this tutorial we will study how to edit any data, subsequent page will discuss on delete section of ZF.

Zend Framework-11:

Edit Book:

Editing a book and its content is identical to the adding. With the help of following coding we can edit the necessary changes. After every entry there is a link called edit which proceeds us to another page which is made for editing any record. In the edit page there will be three text boxes in which the records will be shown and we can make necessary changes in those records, after making changes click the save button and it will take us to the index page again and we can see the updated page. 

Copy and paste the following coding in editAction() method. 



public function editAction()


$this->view->title = "Edit Book";


$form = new Application_Form_Book();


$this->view->form = $form;

if ($this->getRequest()->isPost()) {

$formData = $this->getRequest()->getPost();

if ($form->isValid($formData)) {

$id = (int)$form->getValue('id');

$author = $form->getValue('author');

$publisher = $form->getValue('publisher');

$title = $form->getValue('title');

$books = new Application_Model_DbTable_Books();

$books->updateBook($id, $author,$publisher,$title);


} else {



} else {

$id = $this->_getParam('id', 0);

if ($id > 0) {

$books = new Application_Model_DbTable_Books();







<?php echo $this->form;?>



edit book


Related Tags for Zend FrameWork Part-11:

Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: April 20, 2010

Recommend the tutorial

Advertisements Advertisements