I want to create a form with Zend Framework 2 for my application and I have everything in place and the form is getting displayed but my issue is I am not able to bind the initial form values that come from the database\[code\]$myUserDetails = <details of my user coming from DB>;$form = $form->bind($myUserDetails); //This should set the values for the form to display but it doesnt\[/code\]My display logic is simple as shown below \[code\]$form = $this->form;$form->setAttribute('action', $this->url('<routename>',array('action'=>'<actionname>')));$form->prepare();echo $this->form()->openTag($form) . PHP_EOL;echo $this->formRow($form->get('email_id')) . PHP_EOL;echo $this->formRow($form->get('dob')) . PHP_EOL;echo $this->formRow($form->get('gender')) . PHP_EOL;echo $this->formRow($form->get('user_page_name')) . PHP_EOL;echo $this->formInput($form->get('submit')) . PHP_EOL;echo $this->form()->closeTag($form) . PHP_EOL;\[/code\]Now I tried to set the data from my object that I bind to the form in my controller action\[code\]$myUserDetails = <details of my user coming from DB>;$form = $form->bind($myUserDetails);$data = http://stackoverflow.com/questions/15781979/$myUserDetails->getArrayCopy();$form->setData($data['data']);\[/code\]This seems to work somehow and is displaying my values in the view. So i just want to know what have I done wrong in my first approach? Thanks in advance ![Smile :) :)](https://cdn.jsdelivr.net/joypixels/assets/8.0/png/unicode/64/1f642.png)
![Smile :) :)](https://cdn.jsdelivr.net/joypixels/assets/8.0/png/unicode/64/1f642.png)