title: Passing variable from button to controller Laravel
body: <p>I am having a little routing problem in Laravel 5.2. I have a result page which shows detailed information about personnel. I would like a button, which when enabled, generates a PDF page. Passing the variables has been a problem but I am very close now! I will public my code to elaborate. </p>
  
  <p>result page</p>
  
  <pre><code>&lt;form action="generatePDFpage" method="get"&gt;
        &lt;button type="submit" class="btn btn-default"&gt;Generate PDF!&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>routes.php</p>
  
  <pre><code>Route::get('/dashboard/result/generatePDFpage', 'resultController@GeneratePDFc');
  </code></pre>
  
  <p>GeneratePDFc controller</p>
  
  <pre><code>    public function GeneratePDFc(){
  
          $id_array_implode = "HALLO";    
          $pdf= PDF::loadView('GeneratePDF', ["test"=&gt;$id_array_implode])-&gt;setPaper('a4', 'landscape');    
          return $pdf-&gt;stream('invoice.pdf');
      }
  </code></pre>
  
  <p>So, on the result page I am using a array ($id_array) to search the database for the matching records. I need to pass this variable onto the GeneratePDFc controller, so that I can pass that again to the loadView function! </p>
  
  <p>Could someone please help me out? :-) </p>