如何在没有类的情况下设置表单的名称? [英] How to set the name of a form without a class?
本文介绍了如何在没有类的情况下设置表单的名称?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这里写了如何使用类设置表单的名称:
Here is written how to set the name of a form with a class:
http://symfony.com/doc/2.0/book/forms.html#creating-form-classes
但是如何设置这个表单的名称?
but how to set the name of this form?
$form = $this->createFormBuilder($defaultData)
->add('name', 'text')
->add('email', 'email')
->getForm();
好吧,我正在尝试以这种方式提交后获取帖子参数:
Well, I'm trying to get post parameters after submitting it this way:
$postData = $request->request->get('form_name');
推荐答案
你有什么理由不去做:
$data = $form->getData();
这篇关于如何在没有类的情况下设置表单的名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文