First you need to catch the input then you can save it from $_POST So i assume your input fields names are myplugin_id , myplugin_api_key and myplugin_checkbox what you are currently doing is just going to replace the option with myplugin_checkbox
You can try
function register_myplugin_settings() {
if ( isset( $_POST['myplugin_id'] ) && ! empty( $_POST['myplugin_id'] ) ) {
update_option( 'myplugin_id', sanitize_text_field( $_POST['myplugin_id'] ) );
}
if ( isset( $_POST['myplugin_api_key'] ) && ! empty( $_POST['myplugin_api_key'] ) ) {
update_option( 'myplugin_api_key', sanitize_text_field( $_POST['myplugin_api_key'] ) );
}
if ( isset( $_POST['myplugin_checkbox'] ) && ! empty( $_POST['myplugin_checkbox'] ) ) {
update_option( 'myplugin_checkbox', sanitize_text_field( $_POST['myplugin_checkbox'] ) );
}
}
update_option is straight to save the setting or option with its name. And to retrive data back from database you can use get_option function like
$myplugin_id = get_option( 'myplugin_id' );
if ( ! empty( $myplugin_id ) ) {
//Dosomething when id is not empty
} else {
//Do something when empty
}
If you still want to use the register_setting function just replace update_option with that one and check their documentation how to save the input there https://developer.wordpress.org/reference/functions/register_setting/
Good luck.