2015-05-04 121 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非常聰明,可以獲得所有這些請求值。

相關問題