Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

hero21's avatar

How to Update a User Record with bootstrap modal window

Hi,

For simple edit functionality, we can write the code like this:

'''

    // User Edit view
          <a href="{{route('user.edit',$user->id)}}" class="btn btn-primary btn-xs">Edit</a>    

    //UserController for edit 
    $user = User::findOrFail($id);
         return view('user.edit', compact('user'));  

''' when someone click on Edit link, I will send them to user.edit page with it's id and here we can use model binding to edit data.

So, what if In situation, I want to edit user information in modal windows like bootstrap modal. The Modal will open in the same page, so How can I send the user id for editing data to modal window? Or if anyone have ever tried, please help me ?

thanks :)

0 likes
3 replies
hero21's avatar

@cm, thanks. But I want to do this without using ajax requests. Is it possible ?

cm's avatar

@hero21 Sure, a bootstrap modal is nothing else than regular HTML code plus a bit of JavaScript. Just put your edit form on the same page where you have this code:

<a href="{{route('user.edit',$user->id)}}" class="btn btn-primary btn-xs">Edit</a>

And wrap it in the modal code and then trigger the modal when the Edit button is clicked.

Please or to participate in this conversation.