I have user details from DB and print using blade loop with button for edit. now I want, if I click button I need user details for the button which is clicked for user.
i tried with hidden input filed <input type="hidden" value="{{$user->email}}" name="email">
in my controller I just print the value from form submit. but I am getting only last user.
See below, I hope you will understand..
<div class="content-wrapper">
<div class="flex-center position-ref full-height">
<form action="{!!url('/delete')!!}" method="post"> {!!csrf_field()!!}
<div class="table-responsive">
<table class="table table-hover">
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th>Email</th>
<th>Role</th>
</tr>
</thead>
<tbody>
@foreach($users as $user)
<tr>
<td>{{$user->id}}</td>
<td>{{$user->name}}</td>
<td>{{$user->email}}</td> <input type="hidden" value="{{$user->email}}" name="email">
<td>{{$user->role}}</td>
<td>
<div class="btn-group">
<button type="submit" class="btn btn-primary btn-sm" name="edit" >Edit</button>
<button type="submit" class="btn btn-primary btn-sm" name="delete" >Delete</button>
<button type="submit" class="btn btn-primary btn-sm" name="make" >Make Admin</button>
</div>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</form>
</div>
</div>