I'm really new to Laravel, and I'm not sure that I know what I'm doing. I have a form in my main view. I'm passing the input to a controller, and I want the data to be displayed in another view. I can't seem to get the array from the controller to the second view. I keep getting 500 hphp_invoke. Here's where I'm passing the array from the controller to view2.
public function formSubmit()
{
if (Input::post())
{
$name = Input::get('name');
$age = Input::get('age');
$things = array($name, $age);
return View::make('view2', array('things'=>$things));
}
}
view1.blade.php
{{ Form::open(array('action' => 'controller@formSubmit')) }}
<p>{{ Form::label('Name') }}
{{ $name = Form::text('name') }}</p>
<p>{{ Form::label('Age') }}
{{ $age = Form::text('age') }}</p>
<p>{{ Form::submit('Submit') }}</p>
{{ Form::close() }}
My view2.php file is really simple.
<?php
echo $name;
echo $age;
?>
Then in routes.php
Route::get('/', function()
{
return View::make('view1');
});
Route::post('view2', 'controller@formSubmit');
Why isn't this working?