我正在使用zend框架。我已完成用户注册和登录,但我无法更新用户信息,因为我不知道如何以更新形式显示表单元素值。请告诉我任何解决方案。
答案 0 :(得分:1)
$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;
建议@ 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;
在你的模特里面:
public function fetchClientDetails($id)
{
$row = $this->_db->fetchRow("SELECT * from tablename where id = $id");
return $row;
}