title: Laravel modal form pass input to route as parameter
body: <p>I have a button that calls a modal form where the user can enter a name. I want the submit button in my modal to take that inputted string and append it as a parameter in a specific route. I can't find an example that shows how to get the modal input value into the route call.</p>
  
  <p><strong>Button code in view:</strong></p>
  
  <pre><code>    &lt;button  
          type="button" 
          class="btn btn-info btn-lg" 
          data-toggle="modal" 
          onClick="$('#myModal').modal()"
          style="margin-top: 2px;"&gt;
          New Name
      &lt;/button&gt;
  </code></pre>
  
  <p><strong>Modal form code:</strong></p>
  
  <pre><code>    &lt;div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"&gt;
  
          &lt;div class="vertical-alignment-helper" style="width:50%"&gt;
              &lt;div class="modal-dialog vertical-align-center"&gt;
                  &lt;div class="horizontal-alignment-helper"&gt;
                      &lt;div class="modal-content"&gt;
                          &lt;div class="modal-header"&gt;
                              &lt;button type="button" class="close" data-dismiss="modal"&gt;&lt;span aria-hidden="true"&gt;&amp;times;&lt;/span&gt;&lt;span class="sr-only"&gt;Close&lt;/span&gt;
  
                              &lt;/button&gt;
                              &lt;h4 class="modal-title" id="myModalLabel"&gt;Create New Plan&lt;/h4&gt;
  
                          &lt;/div&gt;
                          &lt;div class="modal-body"&gt;Enter a name for your new plan and we'll do the rest...
                              &lt;p&gt;&lt;/p&gt;
                                  &lt;div class="form-group form-group-lg"&gt;
                                          &lt;label for="firstname" class="control-label"&gt; Plan Name:&lt;/label&gt;
                                          &lt;div&gt;   
                                              &lt;input class="form-control" type="text" id="lg"&gt;
                                          &lt;/div&gt;
  
                                  &lt;/div&gt;
                                  &lt;div class="modal-footer"&gt;
                                      &lt;button type="button" class="btn btn-default" data-dismiss="modal"&gt;Cancel&lt;/button&gt;
                                      &lt;button type="button" class="btn btn-primary"&gt;Create Plan&lt;/button&gt;
                                  &lt;/div&gt;
  
                          &lt;/div&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p><strong>Route I want the submit button to invoke:</strong></p>
  
  <pre><code>Route::get('create-plan/{plan_name}', ['uses' =&gt; 'GeneratePlanController@createplan'])-&gt;middleware('auth');
  </code></pre>
  
  <p>How can I get the user input from the form control <code>&lt;input class="form-control" type="text" id="lg"&gt;</code> into the route call as the <code>{plan_name}</code> parameter?</p>
  
  <p>I'm working in Laravel 5.5 and PHP 7 on XAMPP. My modal form works fine, as does the route/controller when manually called. Just need to wire the two together.</p>
  
  <p>Thanks in advance.</p>