title: Form - Passing array from controller to view - PHP - Laravel
body: <p>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.</p>
  
  <pre><code>public function formSubmit()
  {
      if (Input::post())
      {
          $name = Input::get('name');
          $age = Input::get('age');
          $things = array($name, $age);
          return View::make('view2', array('things'=&gt;$things));
      }
  }
  </code></pre>
  
  <p>view1.blade.php</p>
  
  <pre><code>{{ Form::open(array('action' =&gt; 'controller@formSubmit')) }}
      &lt;p&gt;{{ Form::label('Name') }}
      {{ $name = Form::text('name') }}&lt;/p&gt;
      &lt;p&gt;{{ Form::label('Age') }}
      {{ $age = Form::text('age') }}&lt;/p&gt;
      &lt;p&gt;{{ Form::submit('Submit') }}&lt;/p&gt;
  {{ Form::close() }}
  </code></pre>
  
  <p>My view2.php file is really simple.</p>
  
  <pre><code>&lt;?php
      echo $name;
      echo $age;
  ?&gt;
  </code></pre>
  
  <p>Then in routes.php</p>
  
  <pre><code>Route::get('/', function()
  {
      return View::make('view1');
  });
  Route::post('view2', 'controller@formSubmit');
  </code></pre>
  
  <p>Why isn't this working?</p>