Reputation: 81
I am using zend framework. I have done user registration and login but i can't do update user information because i don't know how to show form element value in update form.Please tell me any solution.
Upvotes: 0
Views: 484
Reputation: 906
$editClientForm = new Form_AddNewClientForm();
$editClientForm->setAction($this->view->baseUrl().'/client/edit');
//fetch client data from your database through model
$clientInfo = $mdlClient->fetchClientDetails($id);
//populate the data to form
$editClientForm->populate($clientInfo);
$this->view->editClientForm = $editClientForm;
After taking suggestion of @php-dev:
$editClientForm = new Form_AddNewClientForm();
$editClientForm->setAction($this->view->baseUrl().'/client/edit');
//fetch client data from your database through model
$mdlClient = new Model_Client();
$clientInfo = $mdlClient->fetchClientDetails($id);
//populate the data to form
$editClientForm->populate($clientInfo);
$this->view->editClientForm = $editClientForm;
Inside your model:
public function fetchClientDetails($id)
{
$row = $this->_db->fetchRow("SELECT * from tablename where id = $id");
return $row;
}
Upvotes: 1