Thursday 4 August 2011

Zend send variable to a form

We create variable that we need in controller:

$this->view->random = date('YmdHis').rand(10000, 9999).rand(10000, 9999);


Then we pass it to a form call in controller:

$this->view->form = new Application_Form_ContentGame(array('random'=>$this->view->random));


And in a form, we get it with:

$random = $this->getAttrib('random');

No comments:

Post a Comment