plugin development – How leave selected checkboxes marked after they are selected and saved in the database

I created a simple plugin. There is an options page and on it, all existing user roles are displayed. Here is the code:

 <h2>Select user roles to send notifications:</h2>
 <?php
   global $wp_roles;
   $roles = $wp_roles->get_names();
   foreach($roles as $role) { $i++; ?>

    <div class="role-wrapper">
    <input name="role()" type="checkbox" id="user_role-<?php echo $i; ?>" value="<?php echo $role;?>">
    <label for="user_role-<?php echo $i; ?>"><?php echo $role;?></label>
    </div>

 <?php } ?>

After the administrator marks the necessary roles in the checkboxes and clicks the submit button, the selected roles are saved to the database.

  if(!empty($_POST('role'))) {
     $new_user_roles = array();
     foreach($_POST('role') as $key=>$value){
         $new_user_roles($key) = $value;
     }
     update_option('choosed_users_role', $new_user_roles);
   }

Then everything works as it should. But, I don’t know how to display the selected checkboxes. After refreshing the page, you cannot see which checkboxes were selected.