2015-05-04 99 views
0

我想将视图中的表单数据传递给控制器​​内部的函数。有什么办法做到这一点?如何在Laravel中将多个变量从视图传递给控制器​​?

+0

HREF =“{{路线(‘getentry’,[$入门>文件名])}}” ,但我不能让它的多个变量 – rajathans

+0

的[提交多个选择值中的行动可能重复的工作Laravel 4](http://stackoverflow.com/questions/16596679/submit-multiple-select-values-to-an-action-in-laravel-4) –

回答

2

简单:

查看

{ Form::open(array('action' => '[email protected]')) }} 
    {{ Form::text('rate', '', array('placeholder' => 'Enter new custom client rate...')) }} 
    {{ Form::submit('Submit', array('class' => 'btn btn-primary')) }} 
{{ Form::close() }} 

在你控制器:

class Controller extends BaseController { 
    public function method() 
    { 
     // get the rate value 
     $rate = Input::get('rate'); 

     or 

     // to get all form values 
     $allFormValues = Input::all(); 

    } 
} 

就是这样。

Laravel非常聪明,可以获得所有这些请求值。

相关问题