title: PHP same form - two functions
body: <p>I have this form here: </p>
  
  <pre><code>  &lt;form  method="post" action="&lt;?=$_SERVER['PHP_SELF'];?&gt;?id={{$theme-&gt;id}}"&gt;
       &lt;input type="hidden" name="_token" value="{{ csrf_token() }}"&gt;
     &lt;input type="hidden" name="price" value="{{$theme-&gt;price}}"&gt;
     &lt;input type="hidden" name="id" value="{{$theme-&gt;id}}"&gt;
    &lt;button type="submit" name="SubmitButton" class="btn btn-success"&gt;&lt;span class="glyphicon glyphicon-shopping-cart"&gt;&lt;/span&gt; buy theme&lt;/button&gt;
    &lt;/form&gt;
  </code></pre>
  
  <p>When I execute this form (I press 'buy theme') the file starts downloading, but the problem is that the page itself doesn't refresh and I don't know how to make that. I want this form to work like that: I press the button - theme downloads + page refreshes or redirects just to homepage. Is it possible somehow ? Thanks.</p>
  
  <p>BTW I'm using Laravel 5</p>
  
  <p><strong>EDIT</strong></p>
  
  <pre><code>                header("Content-type: application/force-download");
                  header("Content-Disposition: attachment; filename=\"".str_replace(" ", "_", $arr['file'])."\"");
                  header('Location: index.php');
  </code></pre>
  
  <p>I added header('Location: index.php'); it redirects to the homepage, but download don't start then. </p>
  
  <p>Route:</p>
  
  <pre><code>Route::get('/download', function(){
      return view('fileentries/download');
  });
  </code></pre>