routes.php
Route::get('/', 'HomeController@showWelcome');
Route::post('/', array(
'before' => 'csrf', // csrf filter
'uses' => 'HomeController@sendEmail' // the controller action to be used
));
hello.php
<?php echo Form::open(array('action' => 'HomeController@sendEmail')) ?>
<!-- input fields here -->
<?php echo Form::close() ?>
HomeController.php
Public function showWelcome()
{
return View::make('hello');
}
public function sendEmail()
{
$data = Input::all();
print_r($data);
// return the same view but with posted fields in the $data array
return View::make('hello', $data);
}