title: Edit db record with modal window
body: <p>I'm trying to edit some database record based on an ID that I'm saving into a button value.</p>
  
  <pre><code>      @foreach ($employment as $empl)
          &lt;button data-toggle="modal" data-target="#edit-empl" href="#edit-empl" class="btn btn-default editbtn-modal" value="{{ $empl-&gt;id }}" type="button" name="editbtn"&gt;Edit&lt;/button&gt;
          &lt;h3 class="profile-subtitle"&gt;{{ $empl-&gt;company }}&lt;/h3&gt;
          &lt;p class="profile-text subtitle-desc"&gt;{{ $empl-&gt;parseDate($empl-&gt;from) }} - {{ $empl-&gt;parseDate($empl-&gt;to) }}&lt;/p&gt;
        @endforeach
  </code></pre>
  
  <p>As you can see here, I have an edit button with an id attached.
  When I click edit I open a modal window to edit the fields and later on submit the form. 
  The thing is, I'm not sure how to get that id from the button into the modal window so I can compare the values and display the correct fields..</p>
  
  <pre><code>&lt;form class="app-form" action="/profile/employment/edit/{id}" method="POST"&gt;
  
    {{ csrf_field() }}
  
    &lt;input class="editID" type="hidden" name="editID" value=""&gt;
  
    @foreach ($employment as $empl)
      @if ($empl-&gt;id == buttonidhere)
        &lt;div class="form-group"&gt;
          &lt;label for="company"&gt;Company:&lt;/label&gt;
          &lt;input type="text" name="company" value="{{ $empl-&gt;company }}"&gt;
        &lt;/div&gt;
  
        &lt;div class="form-group"&gt;
          &lt;label for="month"&gt;From:&lt;/label&gt;
          &lt;input type="date" name="from" value="{{ $empl-&gt;from }}"&gt;
        &lt;/div&gt;
  
        &lt;div class="form-group"&gt;
          &lt;label for="to"&gt;To:&lt;/label&gt;
          &lt;input type="date" name="to" value="{{ $empl-&gt;to }}"&gt;
        &lt;/div&gt;
      @endif
    @endforeach
  
    &lt;div class="row"&gt;
      &lt;div class="col-sm-6"&gt;
        &lt;input type="submit" class="btn btn-primary profile-form-btn" value="Save Changes"&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>I was able to pass the button value into the modal using javascript.. I put it into a hidden input but that doesn't help me at all because I can't get the input value in order to compare the values..</p>