Get the posted data from Form in Zend Framework 2

穿精又带淫゛_ 提交于 2019-12-01 17:40:34

You're not very clear so I suggets a few solutions...

If you need the plain POST value, you can access it using

$this->getRequest()->getPost('name');

From the controller's context.

If you need the value from the form which has been assigned previously, you can access it using

$form->get('elementName')->getValue();

However, if you're using InputFilters, you need to fetch it using

$form->getInputFilter()->getValue('name');

Otherwise, the value you're retrieving was not passed through the filters.

you can do it in the following way: in your controller action

$value = $form->getValue('UserName');

in this way you can get the value of zend textbox having ID 'UserName'

For more details you can study the code given on : Zend Framework Tutorial

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!