-3

I have a edit profile page in which user can change his profile data. Now in the edit user form I want to make the previous database values visible to the user before he edits it.Ho to do that?

leppie
  • 115,091
  • 17
  • 196
  • 297
  • 2
    what have you done so far? What was your research? – Keval Domadia Sep 08 '12 at 11:03
  • I am basically a newbie and have started developing webpages using zend framework. I created an app in which users can register and the registered users can edit their profile etc. While editing I want to populate the previous datas from the database to the edit-profile form. – Arindam Dawn Sep 08 '12 at 12:38
  • Firstly, welcome to Stackoverflow @ArindamDawn . Now, i you could show us some of your code, we can help u. – Keval Domadia Sep 08 '12 at 12:51

1 Answers1

1
public function editAction() {
    $id = $this->_request->getParam('id');

    $articleForm = new Form_Article();
    $articleForm->setAction($this->getRequest()->getPathInfo());

    if($this->getRequest()->isPost()) {
        if($articleForm->isValid($_POST)) {

           // edit logic here
        }
    }
    $articleModel = new Model_Article();

    $article = $articleModel->find($id)->current();
    $articleForm->populate($article->toArray());

    $this->view->form = $articleForm;
}
kasztelan
  • 1,731
  • 3
  • 17
  • 24